We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
JSON++
JSON++ is a powerful data representation language that comes in the form of a strict superset of the popular JSON data language. It supports useful structures such as trees, graphs, and ordered dicts.
Syntax
JSON++ supports new types of data structure and possibly data type that JSON does not natively support, instead requiring that the user build them themselves. These structures and types, both old and new, are:
| Data | Meaning | Representation |
|---|---|---|
| Integer (augmented from JSON) | A whole number from -∞ to ∞ (in theory) | Can be represented in multiple ways: No prefix means decimal, the 0b prefix means binary, the 0q prefix means quaternary, 0o octal, 0x hexadecimal, and 0rn roman numerals. Written using just the digits in that range (hex uses A-F or a-f and roman numerals use {I, V, X, L, C, D, M} or the lowercase equivalent, but you can't mix). Meaningless Underscores available for readability. |
| Real (from JSON) | A real number | Written as the number with a decimal point. If the decimal is 0, can be treated as an integer. |
| String (augmented from JSON) | A list of characters that form a word, sentence, paragraph, or really anything. | Written as the characters padded in quotes (single or double, but must be consistent), with special characters backslash-escaped (the only ones this is really necessary for are quotes, but you can do pretty much any of them). Single words that don't mean anything special are converted to strings. (e.g. walrus == "walrus" && + == "+")
|
| Bool (from JSON) | A 1 or 0, True or False, etc. etc. etc. | Either "True", "False", "T", or "F"
|
| Null (from JSON) | A non-value; the value that represents no data. 1 possible state. | Just "null"
|
| List (from JSON) | An ordered, nestable collection of | The values, separated by commas, padded in [ and ]. Empty list represented as "[]"
|
| Chord (new, syntactic sugar) | A string (converted to a list of integers upon creation) | A quoted string prefixed by "c", equivalent to a list of the character ordinals.
|
| Tuple (new) | A non-growable list (more for the languages reading) | Written as a parenthesis-surrounded comma-separated list. Empty written as "(,)", single-item as "(<val>,)".
|
| Set (new) | A non-ordered collection of items | A comma-separated list padded in "{" and "}".
|
| Dict (from JSON) | An unordered map of items to values | A comma-separated list of key:value pairs padded in {...}. Empty written as {:}.
|
| OrderedDict (new) | An ordered map of items to values | A comma separated list of key:value pairs padded in [...]. Empty written as [:].
|
| SymmetricDict (new) | A map with the property that if x↦y, then y↦x.
|
Written like a normal dict, but key-value pairs are written x<=>y.
|
| OrderedSymmetricDict (new) | An ordered map with the same property as a SymmetricDict | Written like an OrderedDict, but key-value pairs are written x<=>y.
|
| Lispt (new) | A lisp-like list; a special object that tells the computer to perform an operation on | Padded in "(" and ")", no commas. Empty lispt "()".
|
| Edge (new, niche) | A connection between pieces of data, used for graphs | Written value -- value
|
| DiEdge (new, niche) | A directed edge connecting two pieces of data in one direction. | Written origin -> destination
|
| Graph | An undirected graph: a number of "vertices" connected by "edges" | A {|...|}-padded list of edges and scalar values, representing connections and nodes, respectively.
|
| DiGraph | A directed graph: vertices connected by edges monodirectionally | A {|...|}-padded list of diedges and scalar values, representing connections and nodes, respectively.
|
| Matrix | A matrix of values (similar to a singly-nested list, but its own efficient data type) | Matrix is padded with [|...|], with non-comma-separated values inside. Rows are separated by ||</code> symbols (and all must be the same length, of course). All data types must be the same.
|
Note that a JSON++ file that does not have brackets at the toplevel will default to being a scalar, a list, an ordered dict, or a symmetric ordered dict, depending on the inner formatting.
Equivalence to JSON
Though this may change, it JSON is currently equivalent to JSON++. The correspondences are as such (note that the "Pure" JSON versions probably should be written as a length-2 list with the first argument being the type as a string):
- JSON++ integers
10 // decimal 0b10 // binary 0q10 // quaternary 0o10 // octal 0x10 // hexadecimal 0xII // Roman Numerals
- Pure JSON integers
10 // decimal 2 // binary 4 // quaternary 8 // octal 16 // hexadecimal 2 // Roman Numerals
- JSON++ String
abc "narwhals" "I am\nthe walrus" "Hello, World!"
- Pure JSON String
"abc" "narwhals" "I am\nthe walrus" "Hello,\nWorld!"
- JSON++ Tuple
(5, 16)
- Pure JSON Tuple
[5, 16]
- JSON++ Chord
c"Hello, World!"
- Pure JSON Chord
[72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33]
- JSON++ Set
{1, 2, 3}
- JSON Set
[1, 2, 3]
- JSON++ Ordered Dict
[
3: "c",
2: "b",
1: "a"
]
- Pure JSON Ordered Dict
{
"order": [3, 2, 1],
"dict": [
3: "c",
2: "b",
1: "a"
]
}
- JSON++ Symmetric Dict
{
"a" <=> 1,
"b" <=> 2,
"c" <=> 3,
}
- Pure JSON Symmetric Dict
[["a", 1], ["b", 2], ["c", 3]]
- JSON++ Ordered Symmetric Dict
[
"a" <=> 1,
"b" <=> 2,
"c" <=> 3,
]
- Pure JSON Ordered Symmetric Dict
[["a", 1], ["b", 2], ["c", 3]]
- JSON++ Lispt
(+ 1 2 3)
- Pure JSON Lispt
["+", 1, 2, 3]
or:
{
"command": "+",
"args": [1, 2, 3]
}
- JSON++ Edge
a -- b
- Pure JSON Edge
["a", "b"]
- JSON++ DiEdge
a -> b
- Pure JSON DiEdge
["a", "b"]
- JSON++ Graph
{| a, b, c, a -- b, b -- c, c -- a |}
- Pure JSON Graph
[["a", "b", "c"], [["a", "b"], ["b", "c"], ["c", "a"]]
- JSON++ DiGraph
{| a, b, c, d, a -> b, b -> c, c -> a, c -> d |}
- Pure JSON DiGraph
[["a", "b", "c", "d"], [["a", "b"], ["b", "c"], ["c", "a"], ["c", "d"]]
or:
{
"a": ["b"],
"b": ["c"],
"c": ["a", "d"],
"d": []
}
- JSON++ Matrix
[| 1 2 3 || 4 5 6 || 7 8 9 |]
- Pure JSON Matrix
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]