Skip to main content

All Questions

Tagged with
0 votes
1 answer
49 views

How to decode a JSON API (php) call and then display it as text in a ScrollView - SWIFTUI

I have been trying to decode a JSON from a PHP that I have and then displaying the results as Text. I am getting either one of two errors with everything I have tried. The first issue would be "...
HKelz's user avatar
  • 3
0 votes
0 answers
49 views

JSON file cannot be found in SwiftUI project

I'm making a simple JSON loading function in my viewmodel, which retrieves the data from a localized JSON file. However, when I call the function it doesn't seem to find anything at all. func loadJson(...
Thomas Lee's user avatar
0 votes
1 answer
35 views

How to parse JSON from an API in SwiftUI, where the response is not an Array, asynchronously?

I am attempting to parse JSON from an API in SwiftUI where the response is not an Array, this seems to be the only way I can find online, from my searches. An example of the response data is as ...
Sam Staples's user avatar
-4 votes
1 answer
67 views

How to Decode the NOAA Weather JSON into a Swift Struct

When I request data from api.weather.gov I get the following JSON (extract, only up to the first period or hour: { "@context": [ "https://geojson.org/geojson-ld/geojson-context.jsonld&...
logicito's user avatar
  • 175
0 votes
0 answers
52 views

on dismiss() view unable to get update serviceCall in HomeView in SwiftUI

I have HomeView here i am showing favMenu data from favViewModel.fetchFavList. now in HomeView addmore click on i got to FavouriteView here in save button service call i updated the favViewModel....
Swift's user avatar
  • 1,172
0 votes
0 answers
51 views

Swift Json Decoder how to get a nested part of the object without decoding it

I receive server response which contains geojson I need to have the geojson as string and don't want to decode it, but this code throws type mismatch exception. init(from decoder: Decoder) throws { ...
Zahid's user avatar
  • 1
0 votes
2 answers
92 views

Is there a way to decode a JSON key to a differently named codable property in struct in swift

I have and API that I am making a network request to and the API returns some JSON data. From what I've seen, the most common and generally accepted way to handle that JSON data and work with it, is ...
brandontod97's user avatar
-2 votes
0 answers
23 views

How to read a JSON file that is not within the main directory of the Swift app and set different JSON "variables" to Swift variables? [duplicate]

How to read a JSON file that is not within the main directory of the Swift app and set different JSON "variables" to Swift variables? I have a JSON file in a seperate directory which needs ...
CheezGuy's user avatar
-2 votes
0 answers
49 views

Fatal Error : Preview Crash from JSON file

Error Message: Fatal Error in ExtensionFile.swift Trying to retrieve info from the json file but getting a fatal error. JSON link -> https://site.api.espn.com/apis/site/v2/sports/basketball/wnba/...
snesdev's user avatar
2 votes
4 answers
113 views

How to parse JSON that is not defined in CodingKeys

Consider the following JSON: { "jsonName": "fluffy", "color1": "Blue", "color2": "Red", "color3": "Green", &...
alex17's user avatar
  • 21
-2 votes
2 answers
62 views

json string is not converting to model

I have json response as below. {"StatusCode":1,"Data":{"AndroidVersion":"1","IOSVersion":"1"},"Pager":null,"Error":null} ...
Fahim Parkar's user avatar
  • 31.4k
0 votes
1 answer
31 views

How can I make Swift CodingKeys for JSON data with non-unique keys?

I am using the Unsplash API and it gives this response (which is just a snapshot) "exif": { "name": "Canon, EOS 6D" }, "location": { ...
Daniel Crompton's user avatar
0 votes
0 answers
96 views

How to properly stream to a JSON

I have an app that stores photos locally, and I'm trying to create a way for users to send their photo library to another device. I created a LibraryTransferPackage struct which can be successfully ...
zakray's user avatar
  • 163
0 votes
0 answers
147 views

Swift - Codable "Number 2.87 is not representable in Swift"

I have the following struct: struct CustomerEntries: Codable { var date: String var customer_rate: Double var percentage: Double enum CodingKeys: String, CodingKey { case ...
ppp's user avatar
  • 731
2 votes
0 answers
82 views

Issue parsing JSON data

Recently, I am facing issue in parsing the JSON into the model class. { "status": true, "data": [ { "id": "252", "...
Rahul Gupta's user avatar

15 30 50 per page
1
2 3 4 5
558