Reading in json formated response

This forum is for eXpress++ general support.
Post Reply
Message
Author
Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Reading in json formated response

#1 Post 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.

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Reading in json formated response

#2 Post 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.
The eXpress train is coming - and it has more cars.

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Reading in json formated response

#3 Post by Cliff Wiernik »

In my case the output is rather simple but just inquiring so as not to reinvent the wheel.

bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: Reading in json formated response

#4 Post by bwolfsohn »

Did anything ever happen with a json parser ?
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Reading in json formated response

#5 Post 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.

Post Reply