Null Response Parsing with SwiftyJSON
I have a json response from Alamofire like below:
let json: JSON = {
"PathRoute":{.....},
"SharedServicePrice":"2600",
"PrivateServicePrice":"13200",
"Tap30PathPrice":null,
"SnappServicePrice":null,
"SnappBikeServicePrice":null,
"SnappRoseServicePrice":null
}
and it's type is JSON(swiftyJSON type)
when i want to parse "PathRoute" it returns null!!
let pathRoute =json["PathRoute"] print(pathRoute) ---> null i checked everything doesn't work again
using:
- SwiftyJSON: 4.0.0
- Xcode Version:9.2
- Swift Version: 4.0
I am having a similar issue. My JSON is valid, and when I do print(json.description) and print(json.debugDescription) it shows me my JSON string, but when I try to get attributes from the JSON it does not work.
EDIT: I was using Alamofire and was using responseString instead of responseJSON. My problem is fixed now.
@arashgood Did you have the same issue that @logalleg had? I did. Following logalleg's suggestion fixed that same issue for me.
Are you guys using Alamofire.JSON instead of SwiftyJSON.JSON ?