Oct
2017
JSON and Structured Data
JSON and Structured Data
https://www.w3schools.com/js/js_json_intro.asp
JSON replace XML. lightweight data-interchange format. Often used with AJAX (send data forth back client, server, without refresh)
Data types:
number: no dfference between integer and floats
string: string of unicode characters “”
Boolean: true and false
array: ordered list of 0 and more values
Object: unordered collection of key/value pairs
Null: empty value
JSON Syntax Rules:
uses key/value pairs – {“name”;”brad”} . uses double quotes around Key and value . must use the specific data type . file type is “.json” . MIME type is “application/json”
https://code.google.com/archive/p/json-simple/
https://www.linkedin.com/learning/learn-api-documentation-with-json-and-xml/json-basics
strings: text enclosed in single or double quotation marks
numbers: integer or decimal, positive or negative
booleans: true or false, no quot marks
null: means “nothing,” no quot marks
arrays are lists in square brackets, comma separated, can mix data types
objects are JSON dictionaries in curly brackets, keys and values are separated by a colon, pairs are separated by commas. keys and values can be any data type, but string is the most common value for a key
nesting : arrays and objects inside each other
can put arrays inside objects, objects inside