jsondecoder Questions
2
Solved
Was only able to reproduce this issue on a friend's device. The device is from Germany and is set to the German region in Settings. I cannot reproduce on any Canadian devices. Why is it failing whe...
Ligure asked 4/2, 2022 at 22:30
2
Solved
I'm using flask and have a lot of requests. The json module, which is used by flask, is quite slow. I automatically can use simplejson, but thats a bit slower, not faster. According to the document...
Greenish asked 19/2, 2020 at 8:47
2
Solved
I'm new to Swift and I'm trying to upgrade some old Swift code. I'm getting the below warning:
'responseJSON(queue:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:options:completionHandler...
Moldy asked 20/1, 2022 at 16:20
1
I am having a hard time preserving the order of keys in a JSON object stored in a Django JSONField. I have tried using a custom encoder and decoder as per the docs, but the JSON object keeps re-ord...
Danella asked 10/12, 2020 at 10:54
1
In the following program, I have defined a struct with Bool, String and Int, both non-optional and option versions. When I run it, the optional String and Int decodes the json data as expected, but...
Dravidian asked 22/2, 2022 at 7:47
5
Solved
Im facing an issue where I can't make the RealmOptional compatible with swift new Codable feature with json decoder.
Cosider the following Realm object.
class School: Object, Codable {
@objc dy...
Kaon asked 12/7, 2018 at 9:31
1
Solved
While working on Google translate API, I found out some times google can't translate anything, while it keeps raising the same exception: Extra data.
I have searched on the internet, I found a theo...
Ariel asked 1/7, 2021 at 17:31
1
Solved
I've been doing some tests on my models to make sure they are equal when I encode them into JSON and then decode them back using JSONEncoder/Decoder. However, one of my tests failed, and the culpri...
Izard asked 25/6, 2021 at 21:52
1
Solved
I do see a lot of similar questions in stack-overflow, but seems no one is similar with my case. I'm new to Combine frame work, and it took me this whole afternoon to figure out what is wrong, howe...
Pampa asked 11/3, 2020 at 9:47
2
Solved
I've searched thoroughly on Stack Overflow but couldn't find an answer to this problem. I'm trying to use the Google Translate API (googletrans 2.2.0) for Python (3.6.2) and am trying to translate ...
Fabron asked 29/12, 2017 at 10:47
1
Solved
How do I customise the behaviour of JSONDecoder for primitive types like Int, Bool?
Here is the problem:
Backend cannot be relied upon for types. Eg: Bool can come as true/false or "true"...
Ette asked 4/12, 2019 at 20:49
4
Here is struct codable code:
import Foundation
public struct TaskID: Codable {
let embedded: Embedded
}
public struct Embedded: Codable {
let task: [Task]
}
public struct Task : Codable {
le...
Taeniasis asked 15/11, 2019 at 8:9
4
With API I'm working with, I have a case where 1 API Endpoint can return completely different responses, based on if the call was successful or not.
In case of success, API Endpoint returns an Arra...
Leucippus asked 10/11, 2019 at 20:43
1
In playgrounds, the following code produces an error:
import Foundation
struct Model: Codable {
let textBody: String
enum CodingKeys: String, CodingKey {
case textBody = "TextBody"
}
}
let...
Gaskell asked 4/9, 2019 at 23:19
1
Solved
In an asynchronous environment is it more efficient to use one JSONDecoder for all request (Might result in delays if multiple threads are waiting for the lock) or it's more efficient to create a n...
Monetary asked 20/2, 2019 at 13:28
2
Solved
TL;DR
Is there a way that I can use JSONDecoder and write a function which will just read out from given json given field value of specified decodable type?
Imaging I have the following json:
...
Immobilize asked 9/12, 2018 at 22:19
1
Solved
I am trying to parse a response using the JSONDecoder. If there is value for the corresponding key then it goes well, but if there is null value for a key then it fails to compile with the followin...
Yowl asked 29/11, 2018 at 9:33
2
I have below code to test Codable protocol and JSONDecoder.
import UIKit
class ClassA: Codable {
var age: Int = 1
}
class ClassB: Codable {
var ageInfo: ClassA?
var name: String
}
let json4 ...
Hagerman asked 6/7, 2018 at 13:33
2
Solved
Say the JSON looks like this:
[
{
"name": "Spot",
"breed": "dalmation"
},
{
"color": "green",
"eats": "lettuce"
},
{
"color": "brown",
"eats": "spinach"
},
{
"color": "yellow",
"eat...
Theran asked 30/5, 2018 at 1:44
1
I have model as below.
struc Info: Decodable {
var firstName: String?
var lastName: String?
}
While displaying in tableview cell, what I am doing is as below.
personName.text = "\(personArray...
Edmonds asked 28/5, 2018 at 12:28
1
Solved
everyone, how to serialize json struct, if one of field unknown?
My json is:
{"brands":{"any":false,"19":{"is_all":false,"values":[185,182,178],"include":true},"23":{"is_all":false,"values":[19...
Hourglass asked 9/5, 2018 at 14:55
3
Solved
I'm using an API that returns this pretty horrible JSON structure:
[
"A string",
[
"A string",
"A string",
"A string",
"A string",
…
]
]
I...
Homogamy asked 7/3, 2018 at 8:43
3
Solved
I am trying to parse a JSON array which can be
{
"config_data": [
{
"name": "illuminate",
"config_title": "Blink"
},
{
"name": "shoot",
"config_title": "Fire"
}
]
}
or it can be of fo...
Pentathlon asked 18/1, 2018 at 5:58
1
Solved
I'm writing an error logger using Crashlytics and I've come up against an issue that is making me question my understanding of protocols and dynamic dispatch.
When recording non fatal errors using...
Delmadelmar asked 19/1, 2018 at 15:56
1
© 2022 - 2024 — McMap. All rights reserved.