JSON Basic Program
JSON Object
In the following example, we will access the name from the object (data variable).
Example
JSON Array (Improper Representation)
In the following example, we will access the name of the second object in an array (data variable).
Have a close look at the data variable, where keys are not double quoted. Though you can access the variable without any error, it is basically an invalid json.
Note: It is not recommended to use non-double quoted keys in JSON format because it works well inside a <script> tag or in a JavaScript file (.js). But not in a JSON file (.json)
Example
JSON Array (Proper Representation)
In the following example, we will access the name of the second object in an array (data variable).
Have a close look at the data variable, where keys are double quoted and it is a valid JSON.
Example
Reminder
Hi Developers, we almost covered 100% of JSON Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JSON.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.