JSON parsing and emitting.
shows how to parse and emit JSON.
5829 " \"doe\": \"a deer, a female deer\"," "\n"
5830 " \"ray\": \"a drop of golden sun\"," "\n"
5831 " \"me\": \"a name, I call myself\"," "\n"
5832 " \"far\": \"a long long way to go\"" "\n"
5843 CHECK(ryml::emitrs_json<std::string>(tree) == json);
5844 CHECK(ryml::emitrs_json<std::string>(json_tree) == json);
5846 std::stringstream ss;
5848 CHECK(ss.str() == json);
5867 CHECK(ryml::emitrs_yaml<std::string>(json_tree) == json);
5872 CHECK(ryml::emitrs_yaml<std::string>(json_tree) ==
""
5873 "\"doe\": \"a deer, a female deer\"" "\n"
5874 "\"ray\": \"a drop of golden sun\"" "\n"
5875 "\"me\": \"a name, I call myself\"" "\n"
5876 "\"far\": \"a long long way to go\"" "\n"
5882 CHECK(ryml::emitrs_yaml<std::string>(json_tree) ==
""
5883 "doe: a deer, a female deer" "\n"
5884 "ray: a drop of golden sun" "\n"
5885 "me: a name, I call myself" "\n"
5886 "far: a long long way to go" "\n"
void parse_json_in_arena(Parser *parser, csubstr filename, csubstr json, Tree *tree, id_type node_id)
(1) parse JSON into an existing tree node. The filename will be used in any error messages arising du...
void parse_in_arena(Parser *parser, csubstr filename, csubstr yaml, Tree *tree, id_type node_id)
(1) parse YAML into an existing tree node. The filename will be used in any error messages arising du...
#define CHECK(predicate)
a testing assertion, used only in this quickstart
NodeRef rootref()
Get the root as a NodeRef . Note that a non-const Tree implicitly converts to NodeRef.
tag type to mark a tree or node to be emitted as yaml when using operator<<, with options...
void clear_style(bool recurse=false)