Better Forms Helper ... Invalid JSON

I’m seeing these records in my BF Helper File

Inbound (From BF): Invalid JSON TypeError: null is not an object (evaluating ‘obj[i].constructor’)

Outbound (Returned to BF): Invalid JSON TypeError: null is not an object (evaluating ‘obj[i].constructor’)

Is there a way to see which JSON being passed is invalid? How do I investigate this?

In my JSON elements, position 0 is set to null because I want my JSON arrays to line up “one to one” with my FM repetitions.

A snippet of my Inbound from BF shows me this:

				"carAccident" : "Yes",
				"formKey" : 2,
				"responseValues" : 
					"Front,Right Rear,Left Rear",

is null the culprit? I thought null would be seen as a valid entry in JSON…but since it’s telling me

null is not an object

perhaps null is the culprit to my Invalid JSON error?

FWIW … @Andrew helped me figure this out in case anyone else has this issue.

If you’re sending to BF an array of FM repetitions, if BF Helper returns Invalid JSON, check to see if FM is setting any of your reps to null. If so, that will be an issue.

We set the first JSON “repetition” to an empty string "" and that solved the issue.

Although now my repetitions [x] and JSON Array [x] don’t line up, I’m able to fix this with a simple FM script.

Delfs informed me that even though the Helper File was showing INVALID JSON, it may not be INVALID JASON.

one thing, the JSON web viewer in the helper occasionally does not parse valid JSON correctly and indicates an error. You can test for this by copying the raw JSON data into a browser JSON tool to inspect.
In these cases, you can ignore the error. ( fault of the library we use )