Need help with JSON parsing

I know there are tons of JSON threads here, but I’m beating my head against the wall here. Say I have this JSON:

{


	"Sheet1": {
		"Columns": {
			"Column1": "Name",
			"Column2": "Age"
		},
		"StartingCell": "A1",
		"Filter": "[Name] = 'Paul'",
		"UseHeaders": "No"
	},
	"Sheet2": {
		"Columns": {
			"Column1": "Name",
			"Column2": "Age"
		},
		"StartingCell": "A5",
		"Filter": "[Name] = 'Mary'",
		"UseHeaders": "No"
	}
}

I want to be able to

  • Loop through the top level objects (ie Sheet1, Sheet2)
    ** Get Columns as a Dictionary so I can loop through it later
    ** Get the string values of StartingCell, Filter, and UseHeaders

It seems like this SHOULD be somewhat easy, but I just don’t understand JSON well enough.

Preperation:
grafik

Lets loop over the top level properties: myJObject.Properties
Access name / value from the property

grafik

lets use a deserialize to convert it directly to the dict:
grafik

while looping we can access as usually from looped item like:

  • (“KeyName”).Value(of String)
  • SelectToken Method

Kindly note: Prototype statements are for demo purpose and can be decomposed to essential activities like for each, assign…

As shown here:
grafik
And also:
grafik

For each activity: item in myJObject.Properties | TypeArgument: JProperty

  • Assign Activity: prpName = item.Name

Yeah I deleted my reply because I saw it after asking :slight_smile:

This was very helpful. It was the .properties and .value stuff I didn’t know.

For others, @ppr gave me the clues I needed, and this is how I used activities to get what I want:

image
image

Looping through each sheet and getting the simple values:

The rest of the For Each where I get the Columns dictionary and loop through it…

The output:

image

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.