json-thick
is json whose node has metadata attached along with its value.
Work with human interaction either directly with json file or as input/output format used by other user interfaces (e.g. GUI), with extra information on each value, suitable for guided processing or data persistence.
{
"c": "root comment",
"v": {
"a": {
"v": {
"i": { "v": 1, "c": "leaf node comment"},
"j": { "v": 2 }
},
"c": "object node comment"
},
"b": {
"v": [{"v": null}, {"v": null}],
"c": "array node comment"
},
"c": {"v": "a"},
"d": {"v": 1},
"e": {"v": true},
"f": {"v": null}
}
}
{
"a": {
"i": 1,
"j": 2
},
"b": [null, null],
"c": "a",
"d": 1,
"e": true,
"f": null
}
Thick : 228 bytes
Thick : 134 bytes without "c"
(comments)
Thin : 68 bytes
{
"type": "object",
"properties": {
"v": {
"oneOf" [
{ "type": "object", "additionalProperties": { "$ref": "#" } },
{ "type": "array", "items": { "$ref": "#" } },
{ "type": "string" },
{ "type": "number" },
{ "type": "boolean" }
{ "type": "null" }
]},
"c": { "type": "string" }
}
"required": ["v"]
}
- Standard json, not yet another format or extension.
- No special parsers. Existing parser works (e.g
JSON.parse()
) - Commentable on every value.
- Metadata along with value (the schema only requires "v", "c" is does not even necessarily mean a comment here)
- More bytes.
- Extra steps to put and extract values.