October 17, 2018

JSON tutorial for beginners

JSON (JavaScript Object Notation) is a popular data format that you should know. In order to learn JSON, you can view my 10-minute JSON tutorial (with more details) or read on for a quick JSON introduction.
 
JSON data format is language-independent and an alternative to other data formats like CSV or XML. JSON can be understood by both humans and computer devices. Douglas Crockford created the JSON format. 

JSON data values can be of different types - string, number, object, array, boolean and null. A JSON string is a sequence of characters, which is delimited by double quotes on both sides e.g. "name":"John". A JSON number can be an integer or floating point (including Exponential notation) without the double quotes delimiter e.g. "age":30. Here 30 is the JSON number. A JSON object is an unordered set of name-value pairs. There is a colon between the name and its value. The JSON object is delimited by curly braces e.g.
"from": {
   "address": "Brandy@example.com",
   "domain": "example.com",
   "safe sender": true
}
A JSON array is a set of comma-separated values, delimited by square brackets e.g. [1,10,24,40,100]. If the values are strings, then they have to be within double quotes. A JSON boolean can be true or false e.g. "isCustomer": true. A JSON null is an empty value e.g. "vehicle": null. Comments are not allowed in JSON data.

A JSON file is a text file with .json as the JSON file extension. You can type a JSON file using a text editor or create JSON file with JavaScript programming or use a JSON generator e.g. http://jsongen.pykaso.net/

You can see much sample JSON data on the JSON official website at http://json.org/example.html

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.