Answered Parsing JSON with dynamic keys

Potish

Member
I need to parse and load a JSON object with dynamic keys. Is it possible to do so with OE. I am running OE 11.3

Extract from JSON looks at follows

JSON:
    "aircraft": {
      "319": "AIRBUS A319",
      "333": "AIRBUS A330-300",
      "738": "BOEING 737-800",
      "739": "BOEING 737-900",
      "757": "BOEING 757",
      "777": "BOEING 777-200/300",
      "789": "BOEING 787-9",
      "77W": "BOEING 777-300ER",
      "CRJ": "CANADAIR REGIONAL JET"
    },
    "currencies": {
      "USD": "US DOLLAR"
    },
    "carriers": {
      "AC": "AIR CANADA",
      "UA": "UNITED AIRLINES",
      "LH": "LUFTHANSA"
    }
 

Bounty

New Member
Code:
DEFINE VARIABLE FieldNames AS CHARACTER NO-UNDO EXTENT.

FieldNames = JsonAircraft:GetNames().
DO i = 1 to EXTENT(FieldNames):
  JsonAircraft:GetCharacter(FieldNames[i]).
 

Potish

Member
Code:
DEFINE VARIABLE FieldNames AS CHARACTER NO-UNDO EXTENT.

FieldNames = JsonAircraft:GetNames().
DO i = 1 to EXTENT(FieldNames):
  JsonAircraft:GetCharacter(FieldNames[i]).
Thank you. This worked.
 
Top