-
February 23rd, 2022, 02:59 PM
#1
Deserialize JSON file into its parts
I have a JSON file like seen below...
I need to read this into is parts....NOTING that I trucated this JSON file quite a bit to just show one record per section
I need to loop through the "bovaObj" Key and display all the records inside it. For instance there is one here "010033"
--------I need to eventual write this to a table but writing into individual rows in a text box would be fine
I then need to Read down into the "result"
--------WIthin the "Result" key will be 20 or so Keys....as seen below there are "BBA", "County", "HUC12"
--------I need to read all the records and fields into a table from each of these 3 Keys
Any thoughts how to read this deep and how to read the multiple Keys in the "result" indivudually? I would want to read the data inside the "data" subkey for each of the 3 keys "BBA", "County", "HUC12"
Code:
{"results":[{"paramName":"Result","dataType":"GPString","value":{
"bovaObj": {
"010033": [
161094,
"Lepisosteus osseus",
"Gar, longnose",
999,
999,
999,
999,
"[123,223,999]"
],
},
"pythonFinish": "2022-02-23 10:02:42.934000",
"pythonStart": "2022-02-23 10:02:14.877000",
"result": {
"BBA": {
"data": [
{
"AdminComments": null,
"BOVAJSON": "{"040100":["0"],"040248":["0"] }",
"BOVAList": [
"040100",
"040248"
]
}
],
"objectIdField": "OBJECTID",
"title": "BBA",
"url": "https://servicesdev.dwr.virginia.gov/arcgis/rest/services/NeoVafwis/VafwisGuestExtra/FeatureServer/4"
},
"County": {
"data": [
{
"Acres": 373710.367767,
"Area_SqMi": 583.48797607,
"Area_meter": 1512302714.29,
"BOVAList": [
"010033"
]
}
],
"objectIdField": "OBJECTID",
"title": "County",
"url": "https://servicesdev.dwr.virginia.gov/arcgis/rest/services/NeoVafwis/VafwisGuest/FeatureServer/0"
},
"HUC12": {
"data": [
{
"AreaAcres": 24696.58894066,
"AreaSqKm": 99.94363792,
"BOVAList": [
"010131"
]
}
Last edited by jaykappy; February 24th, 2022 at 07:18 AM.
-
February 24th, 2022, 02:27 AM
#2
Re: Deserialize JSON file into its parts
Please, edit your post to properly format the code snipper(s) with CODE tags.
Otherwise your codes/script is very hard to read/understand.
Victor Nijegorodov
-
February 24th, 2022, 07:28 AM
#3
Re: Deserialize JSON file into its parts
am new to this and sort of understand the querying JSON with LINQ but still not sure how to get all the way down to say "BBA"
Very new to this and not sure how to get all the way down to 'BBA' and data:[
I think I have to walk this entire path?: Results > value > result > BBA > data
Code:
{"results":[{"paramName":"Result","dataType":"GPString","value":{
"bovaObj": {
"010033": [
161094,
"Lepisosteus osseus",
"Gar, longnose",
999,
999,
999,
999,
"[123,223,999]"
],
},
"pythonFinish": "2022-02-23 10:02:42.934000",
"pythonStart": "2022-02-23 10:02:14.877000",
"result": {
"BBA": {
"data": [
{
"AdminComments": null,
"BOVAJSON": "{"040100":["0"],"040248":["0"] }",
"BOVAList": [
"040100",
"040248"
]
}
-
February 24th, 2022, 07:33 AM
#4
Re: Deserialize JSON file into its parts
Victor Nijegorodov
-
February 24th, 2022, 07:43 AM
#5
Re: Deserialize JSON file into its parts
Thats the point I have been looking at all of these..thats why I turned to a forum.....I was hoping someone would help with a simple example of how to get to the "BBA":{"data":[]
Im confused how to walk the whole way down from "results"
-
February 24th, 2022, 09:00 AM
#6
Re: Deserialize JSON file into its parts
Well, I had the same problem about three years back in my VC++ project. I've just downloaded some "library" that could parse/encode/decode JSON scripts and then using the https://en.wikibooks.org/wiki/JsonCpp tried to find the functions needed to parse or to write JSON scripts. Kinda Trial-n-Error method!
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|