No description
Find a file
2021-01-27 14:45:19 +08:00
docs Release 1.1.2 2021-01-27 14:45:19 +08:00
examples start from template 2020-11-02 20:34:34 +08:00
src fix header include 2021-01-27 14:39:45 +08:00
tests add tests 2021-01-27 14:39:45 +08:00
.gitignore start from template 2020-11-02 20:34:34 +08:00
.release-it.json start from template 2020-11-02 20:34:34 +08:00
canonicaljson.nimble Release 1.1.2 2021-01-27 14:45:19 +08:00
README.md fix typo in example 2020-12-17 11:04:54 +08:00

canonicaljson

Stringify JSON according to RFC8785.

Usage

API

let s = canonify(%*{
  "numbers": [333333333.33333329, 1E30, 4.50,
              2e-3, 0.000000000000000000000000001],
  "string": "\u20ac$\u000f\u000aA'\u0042\u0022\u005c\\\"/",
  "literals": [newJNull(), true, false]
})

assert s == """{"literals":[null,true,false],"numbers":[333333333.3333333,1e+30,4.5,0.002,1e-27],"string":"€$\u000f\nA'B\"\\\\\"/"}"""