java - What the best way to convert from String to HashMap? -


I want to serial Java Hasham to represent Hashmaps will include only primitive values ​​like strings and integers. After that this string will be stored in DB. How to restore the Hashmap back? Is it wise to use the Beanutils and Interface or use JSON?

For example:

  list list = new ArrayList (); List.add (new long (1)); List.add (new long (2)); List.add (new long (4)); Map map = new hashmap (); Map.put ("city id", new integer (1)); Map.put ("name", "test"); Map.put ("float", new float (-3.2)); Map.put ("id", list); Map.toString () - & gt; {Float = -3.2, iDes = [1, 2, 4], name = test, cityID = 1} map. Yuzon - & gt; {"Float": - 3.2, "id": [1,2,4], "name": "test", "city id": 1}  

Use JSON or


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -