Looping through JSON properties

It looks fine to me.

data.json:

"blocks":{
  "vJb19r)WPw88AL7K#^ZI":{
   "opcode":"control_incr_counter",
   "next":"IV.E7vBXTcdK0jZYX}(o",
   "parent":"lFI}(?:VU3KYI0bg*{_@",
   "inputs":{},
   "fields":{},
  },
  "IV.E7vBXTcdK0jZYX}(o":{
   "opcode":"control_get_counter",
   "next":"FT-ZWL](%!N-(;E6S{1-",
   "parent":"vJb19r)WPw88AL7K#^ZI",
   "inputs":{},
   "fields":{},
  },
  "lFI}(?:VU3KYI0bg*{_@":{
   "opcode":"control_wait",
   "next":"vJb19r)WPw88AL7K#^ZI",
   "parent":null,
   "inputs":{},
   "fields":{},
  },
  "FT-ZWL](%!N-(;E6S{1-":{
   "opcode":"control_all_at_once",
   "next":null,
   "parent":"IV.E7vBXTcdK0jZYX}(o",
   "inputs":{},
   "fields":{},
  }
}

BrokenJSONObject.pde:

String[] brokenJSON = loadStrings("data.json");
String jsonString = "{" + join(brokenJSON, '\n') + "}";
JSONObject json = parseJSONObject(jsonString);
println(json);

output:

{"blocks": {
  "vJb19r)WPw88AL7K#^ZI": {
    "next": "IV.E7vBXTcdK0jZYX}(o",
    "parent": "lFI}(?:VU3KYI0bg*{_@",
    "inputs": {},
    "opcode": "control_incr_counter",
    "fields": {}
  },
  "lFI}(?:VU3KYI0bg*{_@": {
    "next": "vJb19r)WPw88AL7K#^ZI",
    "parent": null,
    "inputs": {},
    "opcode": "control_wait",
    "fields": {}
  },
  "IV.E7vBXTcdK0jZYX}(o": {
    "next": "FT-ZWL](%!N-(;E6S{1-",
    "parent": "vJb19r)WPw88AL7K#^ZI",
    "inputs": {},
    "opcode": "control_get_counter",
    "fields": {}
  },
  "FT-ZWL](%!N-(;E6S{1-": {
    "next": null,
    "parent": "IV.E7vBXTcdK0jZYX}(o",
    "inputs": {},
    "opcode": "control_all_at_once",
    "fields": {}
  }
}}
2 Likes