My problem is close to the issue reported here:

http://xstream.10960.n7.nabble.com/Can-XSTREAM-s-Jettison-JSON-writer-convert-HashMap-to-Javascript-hashtable-td5543.html

but I am not sure I understand what "writing the key as a tag" means. Sorry
for the newbie question.


On Sat, Apr 27, 2013 at 11:22 AM, Venkatesh <vvenka...@gmail.com> wrote:

> Hi !
>
> I have been using XStream to convert from Java objects to JSON and vice
> versa. I had a question and was hoping someone in this list can provide
> some help/guidance. I have a Java object that has a HashMap as a member:
>
> public class MyObject  {
>     private HashMap<String, String> myMap = new ConcurrentHashMap();
> }
>
> I am trying to use XStream to serialize this object and the serialized
> object using default XStream looks like the following:
>
> {
> "MyObject: : {
> "myMap" : [ {"@class" : "java.util.ConcurrentHashMap", "id1" : "data"} ]
>  }
> }
>
> I am looking for something like the following:
>
> "MyObject" : {
> "myMap" : {
> "id1" : "data",
> }
> }
>
> Essentially not treat the myMap object as a array and then adding the
> object type data in the "class". I was looking at the mailing list; but I
> haven't had much success. Any help would be really appreciated.
>
> Venkatesh
>
>
>

Reply via email to