Json nested attributes

Started by spl, July 05, 2024, 11:37:56 AM

Previous topic - Next topic

spl

Consider:
{
  "FoodChoices": [
    {
      "id": 1,
      "name": "TakeOut",
      "variableGroups": [],
      "variables": {
        "Location": {
          "value": "Fast Food"
        },
        "Beverage": {
          "value": "Soda or Lemondade"
        },
        "Tip": {
          "value": "No Way"
        }
      }
    },
    {
      "id": 2,
      "name": "Gourmet",
      "variableGroups": [],
      "variables": {
        "Location": {
          "value": "Nice Resturant"
        },
        "Beverage": {
          "value": "Dirty Martini"
        },
        "Tip": {
          "value": "Maybe"
        }
      }
    }
  ]
}

I know this can be parsed, if you already know the schema in advance but I am looking for a generic method to iterate attributes:values given json w/out 'a priori' knowledge.

Currently trying to see if Microsoft Graph can be used as part of WB's CLR. I did discover I could come up with [tab-delimited]

id 1
name TakeOut
variables.Location.value Fast Food
variables.Beverage.value Soda or Lemondade
variables.Tip.value No Way
id 2
name Gourmet
variables.Location.value Nice Resturant
variables.Beverage.value Dirty Martini
variables.Tip.value Maybe


but am sure Jim or Tony can suggest better output.
Stan - formerly stanl [ex-Pundit]

spl

Oh, and I will be upgrading to latest WB release so as not to appear such an outsider.
Stan - formerly stanl [ex-Pundit]