[TIMOB-20053] JSON.parse not implemented on Windows Phone?
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2015-11-23T16:03:08.000+0000 |
Affected Version/s | Release 4.1.1 |
Fix Version/s | n/a |
Components | Windows |
Labels | n/a |
Reporter | Marian Kucharcik |
Assignee | Christopher Williams |
Created | 2015-11-12T12:40:21.000+0000 |
Updated | 2015-11-23T16:03:08.000+0000 |
Description
Hi guys,
I'm trying to parse simple JSON object loaded from web. On iOS it's working fine. On Android, I have to use eval('('+this.responseText+')'). But on Windows phone, JSON.parse does nothing(when I can choose JSON methods, parse method is only for mobile weband windows logo is grayed ) and eval() crash the app(without any error log).
Can somebody please help me?
Thank you.
I tried to pack JSON.parse into try/catch and it gives me error: SyntaxError: JSON Parse error: Unrecognized token '?' The JSON itself is valid, I tried to parse it via console in browsers, even question mark ? is not present in that text. Thank you
Why do you have to use "eval" on Android specifically? If you can't even parse it without a hitch on Android, then there must be something _fishy _with your JSON data. Could you add the data to the ticket? That would give everyone a better understanding of your issue.
Hi Christian, this is my JSON output from web:
According to jsonlint.com validator it's valid JSON, on iOS JSON.parse hasn't any problem to parse it. On Android I have to use eval(), because of Android implementation of JSON methods(I read about it on Appcelerator's old Q&A, it's working normally). On Windows Phone, eval() cause application crash and JSON.parse throws common error ad can't parse it. If I set the first object of this json to variable as string, hyperlink is not escaped and it's parsed successfully(so for me is JSON.parse working partially) but if I read it from web via HTTPClient, it throws error. Thank you. P.S: question marks added to that JSON are added by text formatter in this JIRA, it's in Slovak language with diacritics
Hi guys, I discovered, that at start of my JSON string, there is a blank space and this cause JSON.parse to throw error. After I removed that, everything works fine. Thank you