The Data Couldn't Be Read Because It Is Missing
SOLVED: The data couldn't exist read because it isn't in the right format.
Forums > SwiftUI
| @iam-that-1
this is the API and this is structs just I got this error. (The data couldn't be read because it isn't in the correct format.). I built the structs from a script 1 |
| @roosterboy HWS+
Is that the actual JSON yous are testing with or did y'all give united states an altered version? Because information technology'due south not valid JSON due to these lines: They should be: i |
| @iam-that-one
yea it is altered, becuase the response contains my information. just I want to know if the structs stand for the json structure or not, and how to do it. The actual JSON is valid and contains an actual breadth and longitude. asking function: 1 |
| @roosterboy HWS+
Aye. Once I corrected the zeroes event, your A tip... When decoding JSON, don't do this: Do this instead: Information technology will give you much more than particular about what the problem is. This: versus this: i |
| @iam-that-ane
I got the problem when I print(error), I inverse latitude, longitude to be String instade of Double, thankyou. ane |
| @iam-that-one
I am sorry. just why some properties contains zero inside. The API has a value. 1 |
| @roosterboy HWS+
Okay, after hunting down some sample API information—which you actually should supply with these types of questions, as your And and then when yous create your OR, you can add explicit key mappings to your Note that doing it this mode would allow you lot to keep 1 |
| @iam-that-i
Thank you, it was my mistake, I merely took sampel of resopnses that is non workes in my case, or non represents the bodily response from API. 1 |
Sponsor Hacking with Swift and reach the earth's largest Swift customs!
Answer to this topic…
You lot demand to create an account or log in to respond.
All interactions here are governed by our code of comport.
Source: https://www.hackingwithswift.com/forums/swiftui/the-data-couldn-t-be-read-because-it-isn-t-in-the-correct-format/7440
إرسال تعليق for "The Data Couldn't Be Read Because It Is Missing"