|
this is the API
and this is structs
but 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 |
|
Is that the actual JSON you are testing with or did you give us an altered version? Because it's not valid JSON due to these lines:
They should be:
|
|
yea it is altered, becuase the response contains my information. just I want to know if the structs represent the json structure or not, and how to do it. The actual JSON is valid and contains an actual latitude and longitude. request function:
|
|
Yep. Once I corrected the zeroes issue, your A tip... When decoding JSON, don't do this:
Do this instead:
It will give you much more detail about what the problem is. This:
versus this:
|
|
I got the problem when I print(error), I changed latitude, longitude to be String instade of Double, thankyou. |
|
|
|
Okay, after hunting down some sample API data—which you really should supply with these types of questions, as your
And then when you create your OR, you can add explicit key mappings to your
Note that doing it this way would allow you to keep
|
|
Thank you, it was my fault, I just took sampel of resopnses that is not workes in my case, or not represents the actual response from API. |
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.