Page 1 of 1
Reading in json formated response
Posted: Thu Jan 26, 2017 5:20 am
by Cliff Wiernik
I see functions in Express++ to convert data to the JSON format. When you make a webrequest that returns a JSON structure as its content, is there a function/example in express to load that into an object or array, similar to the functions to create xml trees objects.
Re: Reading in json formated response
Posted: Thu Jan 26, 2017 7:24 am
by rdonnay
I created functions like DC_Array2Js(), DC_Value2Js(), DC_Object2Js() but it never occurred to me that we may need to convert back from Json to another type. It was easy to go from Xml to a tree view because I use the Alaska XML parser. There is no Json parser. I would have to write one.
Alaska also added functions like Var2Json() and Var2Xml() but they don't have a Json2Var() because the var can be either an object or an array.
JSON is alway a character string and it looks like someone needs to write a parser for it.
Re: Reading in json formated response
Posted: Thu Jan 26, 2017 8:54 am
by Cliff Wiernik
In my case the output is rather simple but just inquiring so as not to reinvent the wheel.
Re: Reading in json formated response
Posted: Mon Apr 17, 2017 11:16 am
by bwolfsohn
Did anything ever happen with a json parser ?
Re: Reading in json formated response
Posted: Mon Apr 17, 2017 11:56 am
by Cliff Wiernik
I have looked at some vb code and some foxpro code but have not delved into trying to write it. For my current usage, it was rather easy as I know what what I would receive and basically just used dc_tokenarray.
But a more robust methodology would be desirable.
Again, I don't know why Alaska, wanting to do more internet enabling would be leaving this out. More users than not would be receiving json to use from services than necessarily sending. But if you are sending, you are likely also receiving.
Sort of like xml.
I know pablo has something using ot4xb.