i have a task serializing a class like RPC message to JSON using Jackson in Java. I have to say that i´m a complete newbie to Jackson. Now what i´m trying to do is to serialize array type into JSON.
I have:
ObjectMapper mapper = new ObjectMapper();
a 然后电文输入HashMap(简化)
LinkedHashMap<String,Object> map = new LinkedHashMap<String, Object>();
if(msg.getSignal())
map.put("signal",msg.getMethodName());
else {
map.put("method", msg.getMethodName());
map.put("retT", msg.getReturnType()); //returns Class<?> type
}
return mapper.writeValueAsString(wrapper);
for method name "add" and return type int[], this results in:
{"method":"add","retT":"[I"}
Can anyhone please help me how to achieve "[int]" instead of "[I"?