A Human Description of JSON For Programmers - adsicks/gambas-json GitHub Wiki
Jeff P. Zacher Zacher Network Solutions
A Json file is composed of json elements. These elements can be divided into 3 classes:
- Single Values
- Objects
- Arrays
Single Values are strings, numbers, and three literal values that are analog to booleans:
- “true”
- "false”
- “null”
Objects are name/value pairs. They are analogs to associative arrays. Objects are enclosed in curly braces: < {} >. They can be empty or composed of members. Object members are json strings (enclosed in double quotes), a colon as a separator: < : >, and a valid element as mentioned above. Each object can have zero or more members. An empty object is said to have zero members. Multiple members are separated by a comma: < , >.
Arrays are ordered lists of values. Arrays are enclosed in square brackets: < [] >. They can be populated with zero or more elements. Multiple elements are separated with a comma: < , >.
Double quotes < “ > , the forward slash < / > , and control characters (codes less than 20h) are reserved and must be escaped for the JSON to be valid. Escaped characters are < “, , /, b, n, r, t, u >. All other Unicode characters 20h and above are valid.
Numbers can be integers, floats e.g., < 123.45 >, or exponentials e.g., < 1.234e-10 >. Strings are enclosed in double quotes < “ >.
Valid whitespace are horizontal tab, line feed, carriage return, space characters – 0009h, 000ah, 000dh, 0020h respectively and the first three are escaped as \t \n \r.