View source: R/canonical_json.R
| mx_canonical_json | R Documentation |
Produces the canonical JSON byte sequence the Matrix specification
requires for signed objects: object keys sorted by UTF-8 byte
sequence, no insignificant whitespace, raw UTF-8 for non-ASCII
strings, integers only (no floats, no exponents, no decimal places,
within [-(2^53)+1, (2^53)-1]), and rejection of NaN, Inf,
NA values, and NA or duplicate object keys. The output is the exact
byte sequence to feed into an ed25519 signer.
mx_canonical_json(x)
x |
An R value: NULL, atomic vector, or list. |
R named lists become JSON objects; unnamed lists and length > 1
atomic vectors become arrays. Length-1 atomics become scalars. To
force a length-1 value to encode as an array, wrap it in a
single-element list(...) or in I() (AsIs values are
always encoded as arrays, names dropped, mirroring jsonlite).
A length-1 UTF-8 character string. The result is the exact byte sequence to write to disk or feed to an ed25519 signer; non-ASCII content is preserved as raw UTF-8 bytes (jsonlite-style \uXXXX escaping is not used).
mx_canonical_json(list(b = 2, a = 1))
# "{\"a\":1,\"b\":2}"
mx_canonical_json(list(key = "abc"))
# "{\"key\":\"abc\"}"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.