map 轉json
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
map.put("key2", 123);
map.put("key3", new Object());
System.out.println(JSON.toJSON(map));
json轉物件
ObjectMapper mapper = new ObjectMapper();
GssbCardExtraInfo obj = null;
try {
obj = mapper.readValue(jsonStr, GssbCardExtraInfo.class);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}