parse parses a YSON string into a typed JavaScript object.
parse
YSON extends JSON to support Yorkie CRDT types:
Text([...])
Tree(...)
YSON formatted string
Parsed YSONValue
YorkieError if parsing fails
const data = parse('{"content":Text([{"val":"Hi"}])}');// { content: { type: 'Text', nodes: [{ val: 'Hi' }] } }// With type parameter:const data = parse<{ content: YSONText }>('{"content":Text([{"val":"Hi"}])}');// data.content is now typed as YSONText Copy
const data = parse('{"content":Text([{"val":"Hi"}])}');// { content: { type: 'Text', nodes: [{ val: 'Hi' }] } }// With type parameter:const data = parse<{ content: YSONText }>('{"content":Text([{"val":"Hi"}])}');// data.content is now typed as YSONText
parseparses a YSON string into a typed JavaScript object.YSON extends JSON to support Yorkie CRDT types:
Text([...])for Text CRDTTree(...)for Tree CRDT