Today, there is a field returned in the data sent to me by the background
tags: "{"area":"XXX","industry":"XXX","kind":"","other":"XXX"}"
This JSON string format is obviously wrong,JSON.parse
Parsing it will also report an error. This value should be returned as
tags: '{"area":"XXX","industry":"XXX","kind":"","other":"XXX"}'
However, I did not find the information specificationJSON stringOfformatHow should it be, and why the data format returned by the background is wrong, please give me the trouble you know, thank you~
MDN–JSONThere is no introduction here
Let the backstage give you this{tags: {"area":"XXX","industry":"XXX","kind":"","other":"XXX"}
Or youJSON.parse('{"area":"XXX","industry":"XXX","kind":"","other":"XXX"})
in addition"{"area":"XXX","industry":"XXX","kind":"","other":"XXX"}"
What the hell is it? The grammatical format is wrong
‘{“key”: “value”, “number”: 1, “object”: {“name”: “this is my name”}}} in this format, the number can be added with double quotation marks or not
It is true that there is no specification to specify the format of JSON string. JSON itself is just a string, which is convenient for data transmission.
Your problem is just a simple data format error, which belongs to the problem of not understanding JSON.
And now that the back-end framework is so mature, shouldn’t there be ready-made API conversion? You back-end students have written strings to you manually?
Isn’t this the format specification of JSON? When you want to return a string the day after tomorrow, just spell single quotation marks. If you really can’t, just turn it by yourselfObjects are represented as key value pairs, data are separated by commas, curly brackets save objects, and square brackets save arrayshttp://www.w3school.com.cn/js…