notesy::json

Reading and writing JSON. Needs nothing.

rustuse notesy::{json, log};

pub fn ready() {
    let value = json::parse(`{"tags": ["a", "b"], "done": false}`)?;
    log::info(`${value.tags.len()} tags`);
    log::info(json::text(#{ count: 3 }));
}
Function What it does
json::parse(text) Ok(value): the JSON as objects, lists, text, numbers, true and false, with null as None. Err(why) for text that isn't JSON, so ? passes the failure on.
json::text(value) A value (true or false, a number, text, or a list or object of those) as JSON text.

A whole number in JSON comes back as an integer, any other as a float.

Every page