Difference between revisions of ".json"
From Coder Merlin
Aidan-kollar (talk | contribs) |
|||
Line 42: | Line 42: | ||
JSON is formatted similar to a dictionary, with key and value pairs. | JSON is formatted similar to a dictionary, with key and value pairs. | ||
There are a few key tricks to learning how to read and write in .json files: | |||
* Curly braces {...} contain objects. | |||
* Square brackets [...] contain arrays. | |||
* Data is stored in name-value pairs separated by a colon, ''':'''. | |||
* Every data pair and item in an array are separated by a comma ''','''. | |||
== References == | == References == |
Revision as of 10:20, 8 September 2021
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
Yeet
What is JSON?[edit]
JSON, also known as JavaScript Object Notation, is a text-based, human-readable data interchange format. The filetype used is .json and is based off of a subset of the JavaScript lnaguage.
Why use JSON?[edit]
Because the file format is text only, JSON data can be easily sent between computers and implemented in various ways.
Uses of JSON[edit]
JSON Syntax[edit]
Below is a sample of JSON syntax:
{
"firstName": "John",
"lastName": "Smith",
"isAlive": true,
"age": 27,
"address": {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021-3100"
},
"phoneNumbers": [
{
"type": "home",
"number": "212 555-1234"
},
{
"type": "office",
"number": "646 555-4567"
}
],
"children": [],
"spouse": null
}
JSON is formatted similar to a dictionary, with key and value pairs.
There are a few key tricks to learning how to read and write in .json files:
- Curly braces {...} contain objects.
- Square brackets [...] contain arrays.
- Data is stored in name-value pairs separated by a colon, :.
- Every data pair and item in an array are separated by a comma ,.
References[edit]
- [What is JSON] (W3 Schools)
- [JSON Introduction] (W3 Schools)
- [Introducing JSON] (JSON)
- [What is JSON?] (Oracle)
- [JSON Tutorial] (RESTful API)
- [What is JSON?] (Codecademy)
- [JSON (Javascript Object Notation)] (TheServerSide)
- [What is JSON?] (Node.js)