On Fri, Nov 16, 2012 at 6:34 AM, Srinivas Naresh Bhimisetty
<shri.naresh_at_gmail.com> wrote:
> Hello people,
>
> I have been struggling with the following problem for the last few hours:
>
> Problem Statement:
> -----------------------------
> Send a Java Map as a JSONObject with the keys being the map keys and
> values being the map values, i.e., lets say, if I have the following map:
>
> Map<String, String> deleteme = new HashMap<String,
> String>();
> deleteme.put("ab","32");
> deleteme.put("fd","d");
>
> I would like to send this object as : {deleteme:{"ab":"32", "fd":"d"}}
Why not as
{ "ab" : "32", "fd":"d"}
which is the natural way to map it as JSON?
Adapter approach is also unnecessary when using POJO mapping: adapters
are only needed with XML (or JSON produced via libraries that emulate
XML API, like Jettison).
With POJO mapping, it would just work; and if you actually want
wrapping, you could use class
public class DeleteMe {
public Map<String,String> delete;
}
to get that "deleteme" added if there is need for it.
-+ Tatu +-