Search code examples
gwtresty-gwt

How to serialze a map in RestyGWT


I want to send a Map<String,Object> to a server using RestyGWT. However, when I serialize a map in the request it adds extra quote escapes around the string keys.

So,

map.put("hello",123);
service.sendRequest(map,callback);

results in JSON being sent of

{"\"hello\"":123}

instead of the desired result

{"hello":123}

Here is the RestyGWT interface:

@POST
@Path("/data")
public void setRequest(Map<String, Object> map, JsonCallback callback);

Solution

  • This behaviour was a bug. It has been fixed in the latest source version, so v1.4 onwards should not see this issue.