JSON - A quick overview
- JSON stands for JavaScript Object Notation
- JSON is a syntax for storing data in Formbird
- JSON makes it possible to store javascript objects as text.
JSON Syntax
- Data is stored in key/value pairs eg: "name":"Fred" - where the key is "name" and the value is "Fred"
- Data is separated by commas eg:
- All data in Formbird is stored in the JSON syntax
"name":"Fred",
"age":55
- Curly braces hold objects, and in Formbird, everything is an object. We refer to this base object as a 'document' eg:
{
"name":"Fred s",
"age":55
}
- Square brackets hold 'arrays' - an array is simply a list of data.
- An array is the 'value' of a key/value pair eg:
{
"name":"Fred",
"age":55
"siblings":["John","Gladys","Henry"]
}
- The value of a key/value pair can be an object eg:
{
"name": {
"firstName":"Fred",
"lastName":"Jones"
},
"age":55
"siblings":["John","Gladys","Henry"]
}
- Arrays can hold objects too eg:
{
"name": {
"firstName":"Fred",
"lastName":"Jones"
},
"age":55
"siblings":["John","Gladys","Henry"],
"parents":[
{"name":"Jane Smith"},
{"name":"John Jones"}
]
}
- This basic structure can be as deep as necessary - for example arrays can contain objects which themselves can contain arrays.