GWT HashMap to/from JSON -


I may have a little tired tonight but here it goes:

I have to do this How do I get GSM / JSON to / from HSMHSAP?

In other words, I want to take a Hashmap , take it representing my Jasmine, store it somewhere and take it back in my original Java presentation.

is not optimized, but should be easy for code: JSONObject

Change the entries of your map and put to a JSONObject (change each value to JSONValue ) ), Then call toString to get the JSON representation.

To parse, get back to JSONObject using a JSONParser , then keyset , Get the values ​​ and enter them in your map (after opening JSONValue s)

But beware of the keys you use! You can not use any kind of key in the form of a property name in JS; And JSON processing in the browser is always going through a JS object (or implementing the JSON parser itself, which will not do the same)

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -