Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

How to parse JSON format?


miq Oct 18, 2020 05:30 AM

I have created a file in USR drive containing a setting for program, in JSON format. This file shall be read everytime the logger restart.

I know how to open and read the file, and store the reading result into a variable, but I cannot find an instruction in Crbasic on how to parse the JSON format.

I am aware that Crbasic has XMLPARSE().

Do Crbasic has something like JSONPARSE()?


JDavis Oct 19, 2020 01:50 PM

XMLParse() can be used on JSON, but is cumbersome if you just want to grab one or two value out of the file.

I would suggest using the InStr() function to locate the start tag for a value, and InStr() again to find the index location for the end. Then, you can use Mid() to grab out the value you want.


miq Oct 19, 2020 10:40 PM

Thank for the hints. JDavis. I'll check the InStr() and the Mid() instructions and see if they can solve my JSON problem.

Thank you,

miq 

Log in or register to post/reply in the forum.