Answer the question
In order to leave comments, you need to log in
What is the best way to process JSON data with JS?
Good day,
Please advise a ready-made script or a good guide, just do not send Json, jQuery, etc. to sites. I
started working with a project in which I receive API in JSON format (such formats are [{..}], {.. .}, [{..}{..}], {[...]}).
I looked all over the Internet and did not find a good explanation of how to work with JSON in JS, only $.getJSON(), but it is also not entirely clear for a beginner (JSON2 is not entirely clear, there is no explanation).
The bottom line is that the data is received as text and boolean data (true, false) and when clicked, change to the opposite data, as well as the output of graphs (flot) from the data.
thanks in advance
Answer the question
In order to leave comments, you need to log in
jsonlint.com - check the content and realize what went wrong.
JSON has pretty strict rules, in particular:
[{label: "value"}] // невалидно
[{"label": "value"}] // валидно
[{"label": 'value'}] // невалидно
Your question is not related to JSON or jQuery at all.
The first is just a data transfer format, the second is a significant simplification of writing code + addition of those properties and methods that the browser may not natively support.
JSON processing - working with objects and arrays (otherwise there is plain plain / text). They just loop through.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question