How to suppress JSON error messages?

Dec 10, 2014
(Using current latest TCMD on Win10 x64) I'm reading variables from a JSON file with
SET variable=%@JSONXPATH[/json/test/[1]/element]

This works just fine. If the element doesn't exist TCC writes to the console
Invalid XPath. "/json/test/[1]/element"

However, I'm unable to suppress this error message - there is to /q for the SET command, and SET ... >nul 2>nul doesn't seem to work on this particular messages (probably from whatever-library TCC uses to manage JSON?).
The help file stats that there are numeric JSON errors (like 10233 for "Invalid XPath"), but I don't see any variable like %_JSONERROR to get them either.

Any hints on how to quiet these JSON error messages, or at least set the variable in a way there's no output to the current console? Thanks!
Try it with the command in parentheses, like this:

( SET variable=%@JSONXPATH[/json/test/[1]/element] ) >& nul:

If I remember correctly, doing it that way does the redirection before variable expansion, so the error message goes to the bit bucket.
Thanks, that's it.

I wonder if there's a top 10 of "TCC quirks that wouldn't be necessary with a modern scripting language", originating in 4DOS' console-based approach. My favorite by far would be charset handling though.

Similar threads