JSON parser
Last updated
Last updated
[data/dictionary/JSON parser]
Parses the JSON string representation of a dictionary.
If the parsing is unsuccessful, the input is forwarded via bounced
.
Example A:
"{"first":1,"third":3,"fifth":5}"@0 received via json
parsed
sends { "first": 1, "third": 3, "fifth": 5 }@0
Example B:
"malformed"@0 received via json
bounced
sends "malformed"@0
More: https://github.com/Cranq-io/cranq-tutorials/tree/main/reference/2_constructing_data/2_6_serialization
Keywords: dictionary, dict, parse, load, from string
json: string
Receives the JSON string to parse. Example: "{"first":1,"third":3,"fifth":5}"
parsed: {string: any}
Sends the parsed dictionary. Example: { "first": 1, "third": 3, "fifth": 5 }
bounced: string
Sends the value of json
, if the parsing was unsuccessful.
error: {"error": string}
Sends error information if the operation has failed. Example: { "error": "Error: ENOENT: no such file or directory, open '/home/user1/dir1/foo.txt'" }