Whenever serialize class objects, there is always class: "ClassName" thing.
I think it's not good, our user can see class tree from json response.
I tried serializer.exclude("class");.
But it works only for the first object's class. If the class(Java bean) has another Java beans as it's children, children's "class" attributes are always shown.
I hope there is an option for removing "class"
Thank you.
KwonNam.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Right now there isn't an easy way to block the class attribute from being written to the string. The next version of flexjson is a big change and allows more flexible exclusions like taking out the class attribute from the json stream by doing something like:
new JSONSerializer().exclude("*.class").serialize( object );
For the time being you'll need to block it from each class you serialize. I know it's not optimal, but the fix is coming soon. I just haven't had much time to dedicate to putting the finishing touches on the release.
Thanks,
Charlie
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Whenever serialize class objects, there is always class: "ClassName" thing.
I think it's not good, our user can see class tree from json response.
I tried serializer.exclude("class");.
But it works only for the first object's class. If the class(Java bean) has another Java beans as it's children, children's "class" attributes are always shown.
I hope there is an option for removing "class"
Thank you.
KwonNam.
KwonNam,
Right now there isn't an easy way to block the class attribute from being written to the string. The next version of flexjson is a big change and allows more flexible exclusions like taking out the class attribute from the json stream by doing something like:
new JSONSerializer().exclude("*.class").serialize( object );
For the time being you'll need to block it from each class you serialize. I know it's not optimal, but the fix is coming soon. I just haven't had much time to dedicate to putting the finishing touches on the release.
Thanks,
Charlie
The latest release has support for wildcards which will allow you to specify:
new JSONSerializer().exclude("*.class").serialize( obj );
Enjoy!
Charlie