All Questions
128 questions
1
vote
1
answer
383
views
Parsing dynamic optional Key-Value JSON in Swift
how to parse dynamic key (!papLZgcMalaVpYzStU:com.matrix.in":)value or modified these two struct for dynamic key handling
struct Join : Codable {
let papLZgcMalaVpYzStUcommatrixin : !...
0
votes
2
answers
92
views
How to parse a string data from array inside JSON another array in Swift 4
I have to show string data into a tableView.
{
"success": [
[
"An Ad with order id 2563 at location DLF, Delhi has been approved | 20 hours before|Shashank Tiwari"
],
[
"...
0
votes
1
answer
736
views
How to send Dictionary as parameter to the Get Request Swift
i have to call GET API like
required :
http://ctesterst.net/api/Customers/homeData?lat=12.456&lng=76.786¤t_app_version=123¤t_device=%7B%22Test%22%3A%22123%22%2C%22name%22%...
0
votes
0
answers
72
views
Show continents on the first tableview and then show countries for the selected continents in another tableview
I have a JSON like this and I need to parse it offline using a Codable model.
In my ViewController I have 2 tableviews, on the first one I have to show only the continents list, on the second ...
1
vote
0
answers
42
views
How can I make Alamofire requests progressively?
I have to send a POST request to a server with Alamofire but need to change the "id" in the body parameters every time that the previous api call has been completed.
Here is what I did so far, but ...
0
votes
0
answers
282
views
Getting Error Error Domain=NSCocoaErrorDomain Code=3840 "No value." UserInfo={NSDebugDescription=No value.} when Running request.httpMethod = "GET"
I am running one of my function to get notifications from server using access token after Logging in, I am getting error at line request.httpMethod = "GET". I am beginner to Swift can some one please ...
0
votes
1
answer
111
views
Unable to Extract token from JSON Response using Almofire in swift4
Can some one help me to how to extract token from one of my web services request using almofire in swift4. I want to store token in one of the variable. below I have posted the JSON response from my ...
0
votes
1
answer
1k
views
How can I send HTML tag string in REST API by using Swift Alamofire?
I need to send HTML string to server.
I am using Swift alamofire and when I try to call Rest api then getting ccs code response from server.
same body format used in PostMan and it's working good.
My ...
-1
votes
1
answer
78
views
How to decode a nested JSON struct with dynamic number of nested levels?
I can receive a JSON file with variable number of nested fields, like for example this:
{
"id": "field1",
"values": [{
"1": [{
"11": ["111", "112"],
"12": ["121", "122"]
}],
"2": [{
...
0
votes
3
answers
998
views
Decoding a JSON array that has no field name
I have a simple JSON file like this.
{
"january": [
{
"name": "New Year's Day",
"date": "2019-01-01T00:00:00-0500",
"isNationalHoliday": true,
...
2
votes
1
answer
11k
views
Invalid type in JSON write (__SwiftValue)
I am trying to pass a Parameters [String:Any] value to JSONSerialization.data and it's throwing error every time.
I know the values of the [String:Any] dictionary is Swifty.JSON objects. But I am ...
0
votes
1
answer
136
views
Struggling to parse NSArray to a string with delimiter to produce a QR code in swift
Hi I am currently trying to parse a JSON array produced by alamofire as below:
[
{
"UUID": "31ea524c-4d19-46f7-b3ec-c9264f9dbc78"
},
{
"UUID": "d0c89800-bbae-4189-88ab-...
3
votes
1
answer
156
views
Swift 4 JSONDecoder Utility Function for Arbitrary Struct
I'm trying to create a utility function which given some Data and a struct which conforms to Decodable can decode the JSON data into the struct as follows:
func decodeDataToModel(data : Data?, model ...
0
votes
2
answers
385
views
JSONDecoder failed to decode nested dictionaries
I'm using JSONDecoder to decode from a JSON file which has nested dictionaries. It fails to decode from the json data to my customized model.
This is what I have tried in my code.
The JSONDecoder ...
0
votes
2
answers
727
views
Swift 4.2 - Decode JSON Where Same Key Is Different Type
I am decoding an object using the following model
struct ACDeviceLastData {
var DA: ACDeviceLastDataBody = ACDeviceLastDataBody()
}
struct ACDeviceLastDataBody {
var amOn: Bool = false
...