Access Json data without reflection

I’ve got some Json from Aseprite I’ve pasted below, it doesnt have an iterator so I cant simply read it in as a Json string and loop over my frames. I’ve read you need to use reflection to iterate it, however the problem I’ve had is reflection doesnt work on Neko.

Are there any simple workarounds to this, or should I attempt to process the text as a string manually?

{ "frames": {
   "BluehairGuy-Run 0.ase": {
    "frame": { "x": 0, "y": 0, "w": 64, "h": 128 },
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 128 },
    "sourceSize": { "w": 64, "h": 128 },
    "duration": 100
   },
   "BluehairGuy-Run 1.ase": {
    "frame": { "x": 64, "y": 0, "w": 64, "h": 128 },
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 128 },
    "sourceSize": { "w": 64, "h": 128 },
    "duration": 100
   },
   "BluehairGuy-Run 2.ase": {
    "frame": { "x": 128, "y": 0, "w": 64, "h": 128 },
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 128 },
    "sourceSize": { "w": 64, "h": 128 },
    "duration": 100
   },
   "BluehairGuy-Run 3.ase": {
    "frame": { "x": 192, "y": 0, "w": 64, "h": 128 },
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": { "x": 0, "y": 0, "w": 64, "h": 128 },
    "sourceSize": { "w": 64, "h": 128 },
    "duration": 100
   }
 },
 "meta": {
  "app": "http://www.aseprite.org/",
  "version": "1.2.6",
  "image": "character/bluehairGuy/BluehairGuy-Run.png",
  "format": "RGBA8888",
  "size": { "w": 256, "h": 128 },
  "scale": "1",
  "frameTags": [
  ],
  "layers": [
   { "name": "Layer 1", "opacity": 255, "blendMode": "normal" }
  ],
  "slices": [
  ]
 }
}

Does it work with haxe.Json?

It does, though I cannot iterate on “frames” without reflection, as its telling me there is no iterator.

Yeah, it looks like "frames" is a list of named objects, not an array. It looks like it would be something like Reflect.field (json.frames, "BluehairGuy-Run 0.ase") due to the spaces, or Reflect.fields (json.frames) might work, not sure what order it would use

Ya thanks, though reflection doesnt work for Neko, so its really slowing down my compile times and making game creation a bit of a hassle.

I was thinking of parsing it myself, something like below:

  public function parseJson(json:String){
    var jsonArray = parseBrackets(json);
  }

  public function parseBrackets(parseMe:String){
    if(parseMe.indexOf('{')==-1){
      //No child node, add whatever junk is inside to end of array
    }else{
      //Add Element Name value pairs to Array  (ex: "X":5)
      firstQuote = parseMe.indexOf('"');
      secondQuote = substring(parseMe,firstQuote).indexOf('"');
      nameBetweenQuotes = substring(parseMe,firstQuote,secondQuote);
      //Recursively Parse inside brackets
      parseMe( substring(parseMe.indexOf('{'),parseMe.indexOf('}')) );
    }
  }

Does anyone know if there is a smarter way to accomplish this?

Huh, what do you mean by that? Should work just fine on Neko. This is the output I get on Neko for trace(Reflect.fields(data.frames)); with your JSON data:

Main.hx:58: [BluehairGuy-Run 0.ase,BluehairGuy-Run 1.ase,BluehairGuy-Run 2.ase,BluehairGuy-Run 3.ase]

Dang, I get a segmentation fault and I figured for sure that had to be it, but I guess not. Thanks very much for the help.