- JSON:
- JSON: JavaScript Object Notation.
- JSON is a syntax for storing and exchanging data.
- JSON is an easier-to-use alternative to XML.
- JSON syntax:
- It is derived from JavaScript object notation syntax:
- Data is in name/value pairs
- Data is separated by commas
- Curly braces hold objects
- Square brackets hold arrays (multiple objects)
- [] -- looks like it is for bunch(multiple sets) of related items
- {} -- looks like it is for one set of related item.
- "" -- looks like every name and value should be in double quotes
- Note: Looks like each set has "name" and "value" with colon seperated. Comma seperated.
- JSON uses JavaScript syntax, but the JSON format is text only, just like XML.
- Text can be read and used as a data format by any programming language.
- JSON names require double quotes. JavaScript names don't.
{"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]}
<employees>
<employee>
<firstName>John</firstName> <lastName>Doe</lastName>
</employee>
<employee>
<firstName>Anna</firstName> <lastName>Smith</lastName>
</employee>
<employee>
<firstName>Peter</firstName> <lastName>Jones</lastName>
</employee>
</employees>
- JSON Files
- The file type for JSON files is ".json"
- The MIME type for JSON text is "application/json"
No comments:
Post a Comment