About JSON and Map

54 views
Skip to first unread message

David Baldo

unread,
Jul 16, 2015, 10:22:05 AM7/16/15
to haxe...@googlegroups.com
Dears,
I'm trying to JSon.stringify() a Map object contains complex objects, not String or Int but two different objects like key and an object like value.

When stringify this map I obtain this:
{}

If I try to stringify a Map<String,String> in same project I obtain this:
{"b":"b","a":"a"}

Anyone can help me to stringify my object as well?
Thanks in advance, David.

PS:
<haxeflag name="-D haxeJSON" /> is in my project properties :)

--
--------------------------------------------------
Ing. David Baldo

RedEvoGames srl

Mob. +393668741752

Email: bald...@gmail.com
Skype: baldodavi

--------------------------------------------------

Benjamin Dubois

unread,
Jul 17, 2015, 12:53:11 AM7/17/15
to haxe...@googlegroups.com
There is an option function in json.stringify.
My guess is that is here specially for complex objects (for instance, how the stringify function could know that the parent property should not be stringified as well ?)

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

David Baldo

unread,
Jul 17, 2015, 6:01:56 AM7/17/15
to haxe...@googlegroups.com
Do you mean use repleacer to say to json how to stringify maps?
Seems not the use of replacer function can be submitted to stringify.
http://stackoverflow.com/questions/4910567/json-stringify-how-to-exclude-certain-fields-from-the-json-string

Thanks for your time,
David.
Reply all
Reply to author
Forward
0 new messages