02-28-2020 01:40 PM - edited 02-28-2020 01:41 PM
Getting error -375003 when running the attached VI. The string in the control has a tab character (\t) after the letters "AFE". If I remove the tab or replace it with a space character (\s), the VI runs fine. From my understanding, there should be no issue with the tab character.
Solved! Go to Solution.
02-28-2020 03:19 PM
JSON, by its official spec, does not allow actual tabs in it.
Just add in a find-and-replace node that replaces all actual tabs with "\t", or find the source of the JSON and change it to comply with the official spec.
03-02-2020 04:11 AM
Here's the entire JSON spec, where it shows that tabs need to be escaped (in the definition of "string").
03-02-2020 07:11 AM
Is the spec you are referring to different from the one wiebe@CARYA is referring to? It says horizontal tab characters are allowed, as long as they are escaped.
And in my case, the string I am trying to decode is using the escaped version of the tab character. I even tried using LabVIEW's tab constant and I get the same error.
03-02-2020 08:11 AM
@B.Settles wrote:
Is the spec you are referring to different from the one wiebe@CARYA is referring to? It says horizontal tab characters are allowed, as long as they are escaped.
It's the same spec. There's only one spec.
@B.Settles wrote:
And in my case, the string I am trying to decode is using the escaped version of the tab character. I even tried using LabVIEW's tab constant and I get the same error.
LabVIEW's tab constant is not an escaped tab character, it's a tab character. Your string contains an unescaped tab character. Both are expected to give an error.
If you set your display to "\" mode, you see "\t". That is a tab, not an escaped tab. It should be "\t" in normal mode, or "\\t" in "\" mode.
How do you build the string? If you'd use the Flatten To JSON, you'd be sure it's valid JSON.
03-02-2020 01:02 PM
Thanks for the clarification. I thought because is was a \t in "codes display" it was escaped. The string is coming from device, so they'll have to update their firmware.
03-03-2020 02:36 AM
@B.Settles wrote:
Thanks for the clarification. I thought because is was a \t in "codes display" it was escaped. The string is coming from device, so they'll have to update their firmware.
Or alternatively, or as a temporary workaround, do a Search And Replace. Search for tabs ("\t"), replace with \t ("\\t").
It would of course be better if they changed there output to valid JSON. If they claim to send valid JSON, they have a bug.