Different results while parsing JSON data via Reflect

38 views
Skip to first unread message

Bora Bilgin

unread,
Nov 28, 2013, 12:53:25 PM11/28/13
to haxe...@googlegroups.com
Hello,

I am getting different result while using Reflect on a JSON string. My JSON string is really simple (has a couple fields such as Firstname, Lastname, Username etc.) and I'm trying to iterate through them.

The following code piece works in Flash target, but not in Neko or Windows targets. Not exactly sure why.

//data is the JSON result I get from my webservice
var parsedData = Json.parse(data);   

for (key in Reflect.fields(parsedData)) {
     var myObj = Reflect.field(parsedData, key);
     trace(myObj);
}

When I target Flash, I can see the trace output for all the objects (approximately 10 objects returned from JSON). When targeting Neko though, instead of seeing multiple lines for the trace output, I only see 1 line, which looks like the complete resultset (not individual objects as in Flash). It looks like it is not iterating over the parsed JSON resultset when targeting Neko.

Is there any other (hopefully cross platform) way to parse JSON output and iterate over the data?

Thanks.

Dan Korostelev

unread,
Nov 28, 2013, 4:42:33 PM11/28/13
to haxe...@googlegroups.com
Could you provide a complete reproducible example? 

четверг, 28 ноября 2013 г., 21:53:25 UTC+4 пользователь Bora Bilgin написал:
Reply all
Reply to author
Forward
0 new messages