开发者

what is the equivalent in java of dictionary from.net?

i'm writing a java client for .net server which uses REST/JSON interface. one of the APIs expects a class with a dic开发者_开发技巧tionary inside it. i tried to use a hashmap in the java client but seems that the serialization to json is different for java's hashmap and .net dictionary? i'm using gson by the way. is there another object i should use in java? is there a workaround besides coding the serialization myself?


Most people would use HashMap<String, String>, or, for some json purposes, HashMap<String, Object>. The Jackson open source library for parsing JSON in Java will happily deliver these (declared via the interface Map<String, something> where 'something' depends on which Jackson API you use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜