Expand description
The parse_json and parse_markdown walks behind two of those builtins,
each gated by its own Cargo feature. See the module docs.
Text-to-value parsers behind the parse_json and parse_markdown
builtins in crate::builtin_fns::builtin_script_fns.
Both hand back a ScriptValue rather than a string, so a script indexes
the result directly instead of parsing text itself; each host converts the
result into its own value type the same way it converts any other
builtin’s return. parse_json and parse_markdown are each behind their
own Cargo feature (json, markdown) so a build that links no script
host carries neither serde_json nor pulldown-cmark.
Functions§
- parse_
json - Parse
srcas JSON into aScriptValue. An object becomes aScriptValue::Map, an array aScriptValue::Array, and a scalar keeps its JSON type. Malformed input yieldsScriptValue::Unit. - parse_
markdown - Parse
srcas markdown into a list of block records, one per heading, paragraph, code block, list item, and horizontal rule, in document order. - script_
value_ to_ json - Write
valueas JSON text: the reverse ofparse_json.