Ord - Outline and Relational Data

A simple and powerful markup language for note-taking and structured information.

Ord JSON mapping

Version 0.7.0-draft, 2026-11-22. A companion spec to Ord specification, of the same version. The Spec's conventions (S1 to S6) and versioning (S10) apply here, and rule IDs that start with C, L, D or T refer to the Spec and the Test format.

1. Scope

2. Shapes

These shapes are the same in both directions.

3. Writing JSON

Acme
→Call Anna
→Workshop
→→hours:: 6
→Planning
→→Book room
→→Send agenda
.
[
  {
    "Acme": [
      "Call Anna",
      { "Workshop": [{ "hours": 6 }] },
      { "Planning": ["Book room", "Send agenda"] }
    ]
  }
]
client:: Acme
Kickoff
→attendees:: Anna; Erik
→Book room
Notes
→todo
→→Book room
Plan
→Steps:: a;
→Call
Retro
→date:: 2026-12-01
→Planning
→→Milk
.
[
  { "client": "Acme" },
  { "Kickoff": [{ "attendees": ["Anna", "Erik"] }, "Book room"] },
  { "Notes": [{ "todo": ["Book room"], "_ord": "node" }] },
  { "Plan": [{ "Steps": ["a"], "_ord": "fields" }, "Call"] },
  { "Retro": [{ "date": "2026-12-01" }, { "Planning": ["Milk"] }] }
]
Call Anna
2026
{}
[]
"{}"
::
""
.
["Call Anna", "2026", {}, [], "{}", "", ""]
a::
b:: ""
c:: x;
d:: []
e:: {}
f:: ;
g:: "{}"
n:: 1.50; -2; TRUE; 1e3
s:: "3"
dt:: 2026-10-15
v:: 007
tag:: a
tag:: b
contact::
→primary:: anna
people::
→Anna
→Erik
k:: x
→Anna
→primary:: anna
client:: [[Acme Corp]]
_id:: acme
.
{
  "a": null,
  "b": "",
  "c": ["x"],
  "d": [],
  "e": {},
  "f": [],
  "g": "{}",
  "n": [1.50, -2, true, 1e3],
  "s": "3",
  "dt": "2026-10-15",
  "v": "007",
  "tag": ["a", "b"],
  "contact": { "primary": "anna" },
  "people": ["Anna", "Erik"],
  "k": ["x", "Anna", { "primary": "anna" }],
  "client": "[[Acme Corp]]",
  "_id": "acme"
}
rows:: x
→a:: 1
→n:: 2
rows::
→a:: 3
rows:: y
.
{
  "rows": ["x", { "a": 1, "n": 2 }, { "a": 3 }, "y"]
}
rows::
→0::
→→a:: 1
→1:: x; y
→2::
same::
→"0":: a
→1:: b
Acme
→0:: x
→1:: 5
.
[
  {
    "rows": [{ "a": 1 }, ["x", "y"], null],
    "same": { "0": "a", "1": "b" }
  },
  { "Acme": ["x", 5] }
]
0:: a
1::
→0:: b
→1:: []
.
["a", ["b", []]]
_json:: "6"
.
"6"
_json:: 1e3
.
1e3
"_json":: 5
.
{ "_json": 5 }

4. Reading JSON

JSON is read by writing it as Ord, as these rules say, and reading the result (Spec, Part 1).

{
  "client": "Acme Corp",
  "hours": 6,
  "rate": 9.50,
  "billable": true,
  "code": "6",
  "flag": "true",
  "big": 1e21,
  "none": null,
  "tags": ["design", "review"],
  "one": ["x"],
  "address": { "street": "Main 1", "city": "Lund" }
}
.
root
  field "client"
    "Acme Corp"
  field "hours"
    "6"
  field "rate"
    "9.50"
  field "billable"
    "true"
  field "code"
    quoted "6"
  field "flag"
    quoted "true"
  field "big"
    "1e21"
  field "none"
  field "tags"
    "design"
    "review"
  field "one" list
    "x"
  field "address"
    node
      field "street"
        "Main 1"
      field "city"
        "Lund"
[
  { "client": "Acme" },
  { "Kickoff": [{ "date": "2026-12-01", "room": "B2" }, "Book room", "Send agenda"] },
  { "Planning": ["Book room", { "Workshop": [{ "hours": 6 }] }] },
  "Follow up"
]
.
root
  field "client"
    "Acme"
  node "Kickoff"
    field "date"
      "2026-12-01"
    field "room"
      "B2"
    node "Book room"
    node "Send agenda"
  node "Planning"
    node "Book room"
    node "Workshop"
      field "hours"
        "6"
  node "Follow up"
[
  { "Kickoff": [{ "attendees": ["Anna Smith", "Erik"] }, "Book room"] },
  { "Acme": [{ "Planning": ["Milk", "Eggs"] }] },
  { "Notes": [{ "todo": ["Book room", "Send agenda"], "_ord": "node" }] },
  { "Q4": [{ "scores": [1, 2] }] },
  { "Retro": [{ "tags": ["Went well.", "x"] }] },
  { "Plan": [{ "Steps": ["a"], "_ord": "fields" }] }
]
.
root
  node "Kickoff"
    field "attendees"
      "Anna Smith"
      "Erik"
    node "Book room"
  node "Acme"
    node "Planning"
      node "Milk"
      node "Eggs"
  node "Notes"
    node "todo"
      node "Book room"
      node "Send agenda"
  node "Q4"
    field "scores"
      "1"
      "2"
  node "Retro"
    node "tags"
      node "Went well."
      node "x"
  node "Plan"
    field "Steps" list
      "a"
[{ "Planning": [] }, "", {}, [], "{}", "6"]
.
root
  field "Planning"
    "[]"
  node quoted ""
  node "{}"
  node "[]"
  node quoted "{}"
  node "6"
{
  "lines": [
    { "name": "Workshop", "hours": 6 },
    { "name": "Spec review", "hours": 9.5 }
  ],
  "rows": ["x", { "a": 1 }, { "a": 3 }],
  "single": [{ "a": 1 }]
}
.
root
  field "lines"
    node
      field "name"
        "Workshop"
      field "hours"
        "6"
  field "lines"
    node
      field "name"
        "Spec review"
      field "hours"
        "9.5"
  field "rows"
    "x"
    node
      field "a"
        "1"
  field "rows"
    node
      field "a"
        "3"
  field "single" list
    node
      field "a"
        "1"
{
  "tags": ["design", "review"],
  "agenda": ["Welcome and introductions", "Budget"],
  "notes": ["Ask about the budget.", "Check the room", 5],
  "note": ["Ask about the budget."]
}
.
root
  field "tags"
    "design"
    "review"
  field "agenda"
    node "Welcome and introductions"
    node "Budget"
  field "notes"
    node "Ask about the budget."
    node "Check the room"
  field "notes"
    "5"
  field "note" list
    node "Ask about the budget."
{
  "matrix": [["a", "b"], ["c"]],
  "mixed": ["x", [], "y"],
  "e": [null, "y"]
}
.
root
  field "matrix"
    node
      field "0"
        "a"
        "b"
      field "1" list
        "c"
  field "mixed"
    "x"
    "[]"
    "y"
  field "e"
    node
      field "0"
      field "1"
        "y"
[
  { "name": "Workshop", "hours": 6 },
  { "name": "Spec review" }
]
.
root
  field "0"
    node
      field "name"
        "Workshop"
      field "hours"
        "6"
  field "1"
    node
      field "name"
        "Spec review"
["Call Anna", { "Acme": [{ "a": 1 }, { "a": 2 }] }]
.
root
  node "Call Anna"
  node "Acme"
    field "0"
      node
        field "a"
          "1"
    field "1"
      node
        field "a"
          "2"
[1, true, null]
.
root
  field "0"
    "1"
  field "1"
    "true"
  field "2"
[{ "a": 1 }]
.
root
  field "0"
    node
      field "a"
        "1"
5
.
root
  field "_json"
    "5"
"6"
.
root
  field "_json"
    quoted "6"
null
.
root
  field "_json"
[]
.
root
  field "_json"
    "[]"
{"_id": "acme", "a": 1, "a": 2}
.
root
  field "_id"
    "acme"
  field "a"
    "1"
  field "a"
    "2"
! J28 1:25

5. Shapes compared

How each common Ord shape looks in JSON, as a summary of the rules above:

Ord JSON
fields on the root {"client": "Acme", "hours": 6}
lines on the root ["Call Anna", "Book room"]
a node with fields {"Workshop": [{"hours": 6}]}
a node with lines {"Planning": ["Book room", "Send agenda"]}
a node with fields and lines {"Kickoff": [{"date": "2026-12-01"}, "Book room"]}
fields and lines on the root [{"client": "Acme"}, "Follow up"]
tags:: a; b, or a and b as lines under tags:: "tags": ["a", "b"]
address:: with city:: Lund under it "address": {"city": "Lund"}
a field line per record "rows": [{"a": 1}, {"a": 3}]
index fields 0::, 1:: ["a", {"b": 2}]
_json:: 5 5

6. Known gaps

JSON read as Ord and written back is the same JSON value, every number as written. What Ord → JSON → Ord loses is Ord's layout, which JSON has no place for:

7. Diagnostics

Codes and severities work as in the Spec (C35 to C37). Positions are in the input: the JSON text when reading JSON, the Ord file when writing JSON. Lines and columns are counted as in the Spec (D9), and a JSON key's position is its opening ".

Code Severity Given when Position
J19.1 warning A field _json isn't the root's only line the field's key
J25 warning An Ord field _ord would read back as a marker (J22) the field's key
J28 warning A JSON object has the same key twice the later key

Source: JSON_mapping.md in ordlang/ord, licensed under CC BY 4.0.