Any way to view a HAXE object as plain text?

designpeg

  • *
  • Posts: 731
I'm working on turning json in to maps and lists, but am hitting problems - part of the problem is that if print to console an item from a map it just shows as (object object) if there was a way of the console showing what was inside the object as text it would be easyir for me to know what's going wrong. Anyone got code to show this?

Justin

  • *
  • Posts: 4716
Try this.

Code: [Select]
var object = myVariableThatIWantToPrint;

trace("{");
for(field in Reflect.fields(object))
{
trace('$field => ${Reflect.field(object, field)}, ');
}
trace("}");
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

designpeg

  • *
  • Posts: 731
Fantastic thanks,  I eventually solved my problem, but this will be invaluable next time.