Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, July 15, 2015 8:28 AM
Hi,
I was wondering if someone could help me. I have a copied the source code of a page and put into a HTML file. On this page are a load of JSON objects and I want to extract some properties. I've attached a snippet of the code
[{"id":"a25711888w49939058p50500258","datasetId":"a25711888w49939058p50500258","name":"100percentdesign.co.uk","isAppProfile":false,"canRead":true,"isPremium":false,"starred":false,"qosLevel":"STANDARD","searchName":"100percentdesign.co.uk"},{"id":"a25711888w49939058p60485636","datasetId":"a25711888w49939058p60485636","name":"blah","isAppProfile":false,"canRead":true,"isPremium":false,"starred":false,"qosLevel":"STANDARD","searchName":"blah"}]
I would like to know how I reference these objects within the source code and then parse the information.
Any help would be greatly appreciated.
Thanks
Rob
All replies (2)
Wednesday, July 15, 2015 8:50 AM ✅Answered
Hi,
Can you refer the link
using C#:
http://stackoverflow.com/questions/6620165/how-to-parse-json-in-c
http://stackoverflow.com/questions/3142495/deserialize-json-into-c-sharp-dynamic-object
using Jquery:
var obj = jQuery.parseJSON( '{ "name": "John" }' );
alert( obj.name === "John" );
Wednesday, July 15, 2015 11:48 AM ✅Answered
your example has 2 items in your JSON object:
[{"id":"a25711888w49939058p50500258",
"datasetId":"a25711888w49939058p50500258",
"name":"100percentdesign.co.uk","isAppProfile":false,"canRead":true,
"isPremium":false,"starred":false,
"qosLevel":"STANDARD","searchName":"100percentdesign.co.uk"},
{"id":"a25711888w49939058p60485636",
"datasetId":"a25711888w49939058p60485636",
"name":"blah","isAppProfile":false,"canRead":true,
"isPremium":false,"starred":false,
"qosLevel":"STANDARD","searchName":"blah"}]
you can **foreach **to expose the properties, see this article:
http://stackoverflow.com/questions/11132288/iterating-over-json-object-in-c-sharp