You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Kean Erickson <ke...@gmail.com> on 2018/10/16 18:50:18 UTC
JAX-RS: deserialization of org.json.JSONObject
Although the javax.json.JsonObject API at is now meant to be used instead,
it's interesting that org.json.JSONObject is properly deserialized in
JAX-RS. The only catch is that every json object nested inside is itself
nested as a value with a key called "map", such that if I had a structure
like this:
"a" : { "b" : "c" }
...the resulting output would be:
"a" : { "map" : {"b": "c"} }
The org.simple.JSONObject library would be completely usable for this
purpose if not for this one strange addition. I'm wondering where this
behavior originates, or the simplest way to change it?
I'm aware that the json processing API is meant to be used instead, but I
find it to be fairly inflexible compared to JSONObject for a few reasons,
so I'd prefer to use the latter if possible.
Thanks,
-Kean
Re: JAX-RS: deserialization of org.json.JSONObject
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Kean
You can write a message body reader/writer to handle org.json.
Le mar. 16 oct. 2018 20:50, Kean Erickson <ke...@gmail.com> a
écrit :
> Although the javax.json.JsonObject API at is now meant to be used instead,
> it's interesting that org.json.JSONObject is properly deserialized in
> JAX-RS. The only catch is that every json object nested inside is itself
> nested as a value with a key called "map", such that if I had a structure
> like this:
>
> "a" : { "b" : "c" }
>
> ...the resulting output would be:
>
> "a" : { "map" : {"b": "c"} }
>
> The org.simple.JSONObject library would be completely usable for this
> purpose if not for this one strange addition. I'm wondering where this
> behavior originates, or the simplest way to change it?
>
> I'm aware that the json processing API is meant to be used instead, but I
> find it to be fairly inflexible compared to JSONObject for a few reasons,
> so I'd prefer to use the latter if possible.
>
> Thanks,
> -Kean
>