Specifications
- JSON Specification
- JSON Schema Specification
- JSON RFC 7159
- JSON Pointer RFC 6901
- JSON Patch RFC 6902
- JSON Reference IETF
A JSON literal can be one of seven types:
- null literal
- true literal
- false literal
- numeric literal
- string literal (delimited by double quotes: " ")
- array literal (delimited by square brackets with comma separators: [ , ]
- object literal (delimited by braces with colon and comma separators: {{{ : , }
Because the elements of an array and the values of an object can be any of the seven literals, JSON literals are recursive.
Object keys must be strings.
Dynamic Type Languages
How to de-serialize and serialize JSON.
JavaScript:
let s = '{"t":1,"f":0}';
let data = JSON.parse(s);
let s2 = JSON.stringify(data);
Python:
import json
s = '{"t":1,"f":0}'
data = json.loads(s)
s2 = json.dumps(data)
Ruby:
require 'json'
s = '{"t":1,"f":0}'
data = JSON.parse(s)
s2 = data.to_json
Shell and jq
Databases
Configuration Files
- YAML
json reference
JSON Data
- mongoexport format
- JSON streams: https://en.wikipedia.org/wiki/JSON_Streaming
Static Type Languages
- go, java, c++
- IDL
protobuf, thrift, what else?
Numeric Types
integers, fractions, floats
- javascript integers
- javascript floating point
Overflow issues integers, floats
Strings
encoding issues
Arrays
ordering issues
Objects
Keys must be strings