decodable Questions

2

I have one JSON response from API as follows, Previous JSON Response: [ { "EmployeeId": 711, "FirstName": "Steve", "LastName": "Jobs" }, { "EmployeeId": 714, "FirstName": "John", "LastNa...
Haletta asked 14/8, 2019 at 7:29

4

Solved

I'm getting error in initialising a struct, please see the screenshot attached below. After debugging I found that including review variable in the struct is giving problem. I can't figure out what...
Stillness asked 20/6, 2018 at 23:24

1

Solved

I'm decoding a JSON response in my Swift App, and the code used to work till it decided to stop working. this is my json reposnse { "foods": [ { "food_name": "Milk...
Stotinka asked 7/4, 2019 at 18:19

2

Solved

I try to parse an api returning a json object. My problem is that some keys are sometime a string, sometime an object like the key "Value" in the following example: [ { "Description": null, "Gro...
Avruch asked 6/10, 2018 at 17:3

1

Solved

I have been playing around with Codable and reading and writing JSON from and to a file. Now I would like to write a custom Coder that can read and write iOS .strings files. Can anyone help me with...
Homologize asked 18/7, 2017 at 14:10

2

Solved

I have a struct that parse JSON using Codable. struct Student: Codable { let name: String? let amount: Double? let adress: String? } Now if the amount value is coming as null the JSON parsing...
Curtcurtail asked 18/4, 2018 at 7:56

2

Solved

I am using a free dates API in my project. I am using Decodable to parse the JSON data. Here I created my struct:- struct jsonStruct: Decodable { var message: Bool? var data: [dateData] } struct d...
Lipson asked 1/12, 2018 at 9:1

2

I have the following JSON {"DynamicKey":6410,"Meta":{"name":"","page":""}} DynamicKey is unknown at compile time.I'm trying to find a reference how to parse this struct using decodable. public...
Monumental asked 12/11, 2018 at 19:27

1

My JSON looks like: { "status": true, "data": { "img_url": "/images/houses/", "houses": [ { "id": "1", "name": "Kapital", "url": "https://kapital.com/", "img": "10fbf4bf6fd2928affb180.svg...
Dollarfish asked 10/9, 2018 at 21:24

1

Solved

{ "responseBody": { "table": { "data": [ [ "Forth Record", null, 0, "2018-08-23T18:30:01.000+0000", 0, 0, "HCL", "b74d10ef4fe246948cd036071787ff25" ], [ "Third Record", "Testing cust...
Procreant asked 24/8, 2018 at 11:24

5

Solved

{ "values":[ [1,1,7,"Azuan Child","Anak Azuan","12345","ACTIVE","Morning",7,12,"2017-11-09 19:45:00"], [28,1,0,"Azuan Child2","Amran","123456","ACTIVE","Evening",1,29,"2017-11-09 19:45:00"] ] } O...
Luis asked 10/11, 2017 at 3:33

2

Solved

Context I am working with the Firebase Database REST API and JSONDecoder / JSONEncoder. It's been working pretty well so far. However for removing data the expected returned response is null, and ...

2

Something I havent figured out or have been able to find online as of yet. Is there a way to add additional fields onto a struct containing the decodable protocol in which are not present in the J...
Phonetics asked 7/9, 2017 at 20:48

3

Solved

I have the following code to extract a JSON contained within a coding key: let value = try! decoder.decode([String:Applmusic].self, from: $0["applmusic"]) This successfully handles the following...
Adeno asked 17/5, 2018 at 10:38

1

Not able to figure why my class does not conform to Codable Please not that in my case I do not need to implement the methods encode and decode. public class LCLAdvantagePlusJackpotCache: Codable ...
Epidemiology asked 30/5, 2018 at 16:26

2

Solved

My app uses a server that returns JSON that looks like this: { "result":"OK", "data":{ // Common to all URLs "user": { "name":"John Smith" // ETC... }, // Different for each URL "data_fo...
Footsie asked 22/5, 2018 at 7:8

1

Can Someone help me to solve the problem, length of Int I am trying to get values from a JSON. After executing, I always get the error is: Error serializing json: dataCorrupted(Swift.DecodingError...
Impractical asked 11/5, 2018 at 10:3

3

Solved

How does the Swift 4 Decodable protocol cope with a dictionary containing a key whose name is not known until runtime? For example: [ { "categoryName": "Trending", "Trending": [ { "category"...
Roof asked 9/8, 2017 at 18:47

3

Solved

I want to load an online json file into my application, but I am running into this error: typeMismatch(Swift.Array, Swift.DecodingError.Context(codingPath: [], debugDescription: "Expected to ...
Prytaneum asked 4/5, 2018 at 17:3

2

Solved

I'm trying to implement a Decodable to parse a json request but the json request has a dictionary inside of the object. Here is my code: struct myStruct : Decodable { let content: [String...
Cesura asked 25/4, 2018 at 19:5

3

Solved

I am trying to use Swift 4 Decodable to parse an array that contains two different types of objects. The data looks something like this, with the included array being the one that contains both Mem...
Buchholz asked 28/3, 2018 at 15:28

2

Solved

EDIT: As Rob Napier wrote, the problem exists in Xcode 9.2. In Xcode 9.3 the issue is no longer relevant. My server json responses are all packed inside data object: { "data": {...} } So I ha...
Deuteragonist asked 28/3, 2018 at 17:14

1

Solved

Given the following JSON document I'd like to create a struct with four properties: filmCount (Int), year (Int), category (String), and actor (Actor array). { "filmCount": 5, "year": 2018, "ca...
Hawaii asked 22/3, 2018 at 19:40

1

Solved

I'm trying to write a POST request to my local server, this is my function: @IBAction func postButtonAction(_ sender: UIButton) { guard let url = URL(string:"http://localhost:443/api/message") e...
Engadine asked 18/10, 2017 at 8:0

2

Solved

I'm working with the docodable protocol and I'm having this error: typeMismatch(Swift.Dictionary<Swift.String, Any>, Swift.DecodingError.Context(codingPath: [MakeApp_v2.Params.(CodingKeys in...
Zionism asked 5/3, 2018 at 7:5

© 2022 - 2025 — McMap. All rights reserved.