How I check for valid JSON.

Discussion created by usermac on Dec 7, 2018
Latest reply on Dec 8, 2018 by fmpdude

I use JSON to move data between files as I'm sure a lot of you do however I needed a way to verify the JSON was valid to continue the script. So I set a field with JSON and run this script (see screenshot). It worked and has worked great for over a year now. I hope it helps you too. - Brian

Screen Shot 2018-12-07 at 3.51.30 PM.png

The if statement is the real key here. The target field was just populated with JSON when this script step is run. It works because FileMaker will report "Syntax error" as text if the JSON is not well-formed.