Closed ghost closed 7 years ago
@dgma was this on iOS
?
The same issues occurs when I run on iOS < 10. The JSON data is supposed to be an array but on iOS 8 and 9 it is within parenthesis. @dgma have you managed to solve this, or @roblav96 do you have more info on this?
@davidpronk yes I found that something was wrong when parsing JSON, that was solved on this github repo but I don't know why when you install this plugin, all the code its so different, so I replace all code found here on my plugin installed, hope can help https://github.com/gethuman/nativescript-https/blob/master/https.ios.ts
In turns out my issue was caused by the JSON being returned by the API. iOS < 10 improperly handles [{"foo": "bar"}]
where it does know how to handle {"data": [{"foo": "bar"}]}
even though an array is valid JSON.
The fork by @cbellone seems to have fixed this problem - see https://github.com/cbellone/nativescript-https/compare/89443e50d51c9aac51e3b7914921a1ed92b1480a...cbellone:004f2bfb414fa6cb9914db45dd817acbbc2cd7fb
Actually, turns out this is a 'feature'. JSON Arrays are prone to a specific attack - see https://haacked.com/archive/2009/06/25/json-hijacking.aspx/
Hi! when my request return response, JSON arrays format is different that I expect, this is the format I want: JSON: {array:["one", "two", "three"]}
Response I have:
JSON: {array:("one", "two", "three")}
brackets for array are normal brackets instead of square brackets... what's wrong?