We discussed about Introduction to JSON, JSON Syntax,JSON Datatypes, JSON vs XML (Difference) and JSON Parsing in the previous posts.
If you quickly want to revisit those topics, please click through the below links:
In this post, we are going to discuss about how a JSON string can be parsed before we extract values from them.
As JSON is widely used in almost all web applications, we need to know the better way of parsing it to avail the benefit of using it.
Similarities between JSON and XML:
- JSON is plain text like XML
- JSON is “self-describing”(human readable) and “self-understandable” as XML
- JSON is hierarchical (values within values)
- JSON data can be transported using AJAX
JSON supports following datatypes:
It can be a decimal integer or decimal floating point number. Octal and hexadecimal formats are not supported.
JSON Syntax Rules
JSON syntax is as follows: