2.2 Json PDF
2.2 Json PDF
{ "name" : "value" }
{
"name1": "value",
"name2": "value",
"name3": "value"
}
{
"name": [{
"name": "value"
}, {
"name": "value"
}]
}
Tool : https://jsonlint.com/
Data Structures
collection of name/value pairs : Think Object format
Structured Data
Array - ordered sequence of values uses square brackets. Values are each
separated by a comma. Indexing starts with 0. {"name": [{"name1": 1},
"hello", "world"]}
https://jsonlint.com/
https://jsonschema.net/
{
"car1": "black",
"car2": "blue"
}
Objects in JavaScript
Try this in the console
var myJSON = {};
myJSON.car1 = "black"
console.log(myJSON)
myJSON.car2 = "blue"
console.log(myJSON)
https://developers.google.com/maps/documentation/geocoding/start?csw=1
http://maps.googleapis.com/maps/api/geocode/json?address=Toronto
Search APIs
https://apigee.com/console/
JSON vs XML vs YAML
JSON and XML are human readable formats JSON is faster to write. XML has not arrays. JSON much easier to
parse in JavaScript
JSON Schema
JSON Schema specifies a JSON-based format
to define the structure of JSON data for
validation, documentation, and interaction
control. It provides a contract for the
JSON data required by a given application,
and how that data can be modified.
https://en.wikipedia.org/wiki/JSON
Tool https://jsonschema.net/
Difference: JSON & JavaScript Object
JSON all keys must be quoted, object literals it is not necessary:
{ "foo": "bar" }