You can use regular serialization (de), as Raf Levien says, however Gson initially understands maps.
If you run this, you will get the result {"A": "B"}
Map<String, String> map = new HashMap<String, String>();
map.put("A", "B");
System.out.println(new Gson().toJson(src));
. Json, Gson TypeToken, Gson , Java.
Map fromJson =
new Gson().fromJson(
"{\"A\":\"B\"}",
new TypeToken<HashMap<String, String>>() {}.getType());
System.out.println(fromJson.get("A"));
, .:)