Download

tomo-json

A Tomo library for parsing JSON

  • Tomo
Code 209 linesTomo 204INI 3Dotfile 2
Docs 85 wordsMarkdown 85
NameModifiedLinesSize
.gitignore 2 lines<1% of this folder's lines 15 B<1% of this folder's bytes
CHANGES.md 20 lines7% of this folder's lines 350 B4% of this folder's bytes
README.md 19 lines7% of this folder's lines 459 B5% of this folder's bytes
json.tm 230 lines84% of this folder's lines 8.5 KiB90% of this folder's bytes
packages.ini 3 lines1% of this folder's lines 178 B2% of this folder's bytes

README.md

JSON

This is a Tomo library for encoding/decoding JSON values.

Usage

>> j := JSON({"key1"=123, "key2"=[yes, {"ok"="inner"}, JSON.Null]})
= JSON.Object({"key1"=Number(123), "key2"=Array([Boolean(yes), Object({"ok"=String("inner")}), Null])})

say("$(j.encode())")
say("$(j.pretty_print())")

when JSON.parse("[1, null, true]") is Success(obj)
    >> obj
is Failure(msg)
    fail("Failed to parse JSON: $msg")