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...
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...
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...
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...
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...
2
Solved
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...
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...
1
My JSON looks like:
{
"status": true,
"data": {
"img_url": "/images/houses/",
"houses": [
{
"id": "1",
"name": "Kapital",
"url": "https://kapital.com/",
"img": "10fbf4bf6fd2928affb180.svg...
1
Solved
{
"responseBody": {
"table": {
"data": [
[
"Forth Record",
null,
0,
"2018-08-23T18:30:01.000+0000",
0,
0,
"HCL",
"b74d10ef4fe246948cd036071787ff25"
],
[
"Third Record",
"Testing cust...
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 ...
Pryor asked 2/8, 2018 at 22:32
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...
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...
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 ...
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...
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...
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"...
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 ...
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...
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...
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...
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...
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...
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...
© 2022 - 2025 — McMap. All rights reserved.