Jeff Collins
asked on
Best way to parse out a json string in VB6?
I'm currently calling a web service that is providing a json feed using VB6. What is the best way to parse the information. I currently have the string being returned which I am dumping to a rich text box and formatting for test purposes, but would like to know what the best recommended way of parsing the variable names, and data out.
Is it best to simple runs through and parsing it as a string, using pointers and counters etc... to determine the various sections, or is there a pre-written function somewhere that makes the task slightly less cumbersome? Any thoughts would be good, not after a complete guide.
A sample of the receiving string is as follows:
Is it best to simple runs through and parsing it as a string, using pointers and counters etc... to determine the various sections, or is there a pre-written function somewhere that makes the task slightly less cumbersome? Any thoughts would be good, not after a complete guide.
A sample of the receiving string is as follows:
{
"section":[
{
"client_id":"1124290",
"m_code_4char":"JCOL",
"venue":"Johnny Collingworth",
"updated_ts":null,
"invoices":[
{
"no":100,
"description":"Fees - Jan",
"value":300.50,
"reduction":0,
"updated_ts":null
},
{
"no":101,
"description":"Fees - Feb",
"value":450.00,
"reduction":0,
"updated_ts":null
},
{
"no":102,
"description":"Fees - Mar",
"value":125.00,
"reduction":0,
"updated_ts":null
},
{
"no":103,
"description":"Fees - Apr",
"value":87.50,
"reduction":0,
"updated_ts":null
},
{
"no":104,
"description":"Fees - May",
"value":786.00,
"reduction":0,
"updated_ts":null
},
],
"client_ReductionFactor":0
},
{
"client_id":"1124291",
"m_code_4char":"JSMI",
"venue":"Johnny Smith",
"updated_ts":null,
"invoices":[
{
"no":105,
"description":"Fees - Jan",
"value":300.50,
"reduction":0,
"updated_ts":null
},
{
"no":106,
"description":"Fees - Feb",
"value":450.00,
"reduction":0,
"updated_ts":null
},
{
"no":107,
"description":"Fees - Mar",
"value":125.00,
"reduction":0,
"updated_ts":null
},
{
"no":108,
"description":"Fees - Apr",
"value":87.50,
"reduction":0,
"updated_ts":null
},
{
"no":109,
"description":"Fees - May",
"value":786.00,
"reduction":0,
"updated_ts":null
},
],
"creditnotes":[
{
"no":10035,
"description":"Fees - Jan",
"value":-75.00,
"updated_ts":null
},
{
"no":10036,
"description":"Fees - Feb",
"value":-45,
"updated_ts":null
},
],
"client_ReductionFactor":0
},
],
"feed_version":1.09,
"server_ts":0
}
ASKER
Thanks Pawan,
This would be for the .NET environment wouldn't it? The software I'm modifying is classic VB6.
This would be for the .NET environment wouldn't it? The software I'm modifying is classic VB6.
No the code is for VB6. Pls Try it out.
ASKER
Thanks, I'll try now.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I recommend points split between
Ryan Chong
https://www.experts-exchange.com/questions/28975361/Best-way-to-parse-out-a-json-string-in-VB6.html?anchorAnswerId=41836367#a41836367
Aikimark
https://www.experts-exchange.com/questions/28975361/Best-way-to-parse-out-a-json-string-in-VB6.html?anchorAnswerId=41840235#a41840235
Ryan Chong
https://www.experts-exchange.com/questions/28975361/Best-way-to-parse-out-a-json-string-in-VB6.html?anchorAnswerId=41836367#a41836367
Aikimark
https://www.experts-exchange.com/questions/28975361/Best-way-to-parse-out-a-json-string-in-VB6.html?anchorAnswerId=41840235#a41840235
Open in new window
Also look at this blog post -
http://www.newtonsoft.com/json/help/html/Introduction.htm