Parse JSON safely
FreeLogic@rabbinatix/parse-json-safely by Rabbinatixupdated Oct 4, 2026
Reads JSON text, or reports `INVALID_JSON` instead of failing.
Parse JSON fails on bad text; inside Try the failure goes to Catch, which keeps the error code.
Shows: Parse JSON, Try / Catch / Finally, Variables.
How to use it
Add it to your logic, then add a Call Function step in any logic and pick Parse JSON safely. It belongs to no system, so every system can use it. Or download the TypeScript and call it from your own code.
Inputs
text: Text
Outputs
value: Any value
ok: Yes / No
error: Text (may be empty)
Previewdrag the steps around; scroll to zoom
Function Entry, Input / output. 0 inputs, 2 outputs. step 1 of 11
Parse JSON safely
text
Try / Catch, Flow control. 1 input, 4 outputs. step 2 of 11
Try / Catch
Try
Catch
error
Finally
Parse JSON, Data. 1 input, 1 output. step 3 of 11
Parse JSON
text
value
Set Variable, Data. 2 inputs, 2 outputs. step 4 of 11
Set value
value
value
Set Variable, Data. 2 inputs, 2 outputs. step 5 of 11
Set ok
value
value
Get Property, Object. 1 input, 2 outputs. step 6 of 11
Get .code
object
code
exists
Set Variable, Data. 2 inputs, 2 outputs. step 7 of 11
Set error
value
value
Get Variable, Data. 0 inputs, 1 output. step 8 of 11
Get value
value
Get Variable, Data. 0 inputs, 1 output. step 9 of 11
Get ok
value
Get Variable, Data. 0 inputs, 1 output. step 10 of 11
Get error
value
Return, Input / output. 4 inputs, 0 outputs. step 11 of 11
Return
value
ok
error
Arrow keys: next or previous step in flow order. Alt with arrows: nearest step in that direction. Enter: open. Shift F10: more actions.
Examplesrun live against the logic · 2/2 pass
| Passed | Example | Input | Output |
|---|---|---|---|
| Valid JSON | {"text":"{\"a\":[1,2]}"} | {"value":{"a":[1,2]},"ok":true,"error":null} | |
| Not JSON | {"text":"nope"} | {"value":null,"ok":false,"error":"INVALID_JSON"} |
Try it
Versions
In this package
Parse JSON safely (entry)
