Read json issue

Hi All,

{“response”:
{“ttAllCustomers”:
{“ttAllCustomers”:
[{“CustName”:“Lift Tours”,
“href”:“http://10.0.0.17:8810/rest/CustomerOrderAppService/Customers/1”,
“Country”:“USA”,
“Comments”:“This customer is on credit hold.”}

Any idea how to parse the above json into a dictionary?

Thanks for your help

This is how you parse JSON into a dictionary.

But it will fail as the json you wrote isn’t valid json.

//If the json starts with {
Dim dic as xojo.core.dictionary = xojo.data.ParseJson(jsonData)

//if the json starts with [
Dim dictionaries() as auto = xojo.data.parsejson(jsonData)

For each dic as xojo.Core.dictionary in dictionaries

Next

json tutorial:

http://www.w3schools.com/js/js_json_intro.asp

Thanks Guys,

The json is retrieved from a Rest application created using Openedge Developer (Progress), I can’t imagine that Progress is creating a wrong json.
What I want to do is read the data using a certain key value. I’m able to parse the json data into a data dictionary, but reading the dictionary is a bit frustrating.

Thanks,

In that case maybe you only pasted part of the JSON answer.

What really helps me analysing JSONdata is https://jsonformatter.curiousconcept.com

Keep in mind that JSONdata can either be an array of dictionaries or a dictionary.
Each value can then contain a Text, Integer, Boolean, another dictionary or array of dictionaries.

Or Double or Nil.

Thanks guys for your ideas. I have been able to solve this matter.
By using the Advanced REST Client in chrome I was able to view the data in a different way. It showed me that my data is stored in a array of dictionaries. Also this tool showed me that the received json file was formatted correctly.
I also used the validator, as suggested by Jeremie, it showed me also a positive message in regards to the json format.