List of utility methods to do Json to Object
T | decode(String httpMessageBody, Class decode try { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(httpMessageBody, objectClass); } catch (IOException e) { throw new IllegalArgumentException("httpMessageBody is not a valid JSON", e); |
JsonNode | decode(String input) decode return decode(input, false);
|
T | decode(String json, Class decode try { return mapper.readValue(json, clazz); } catch (IOException e) { throw new RuntimeException("Can't serialize object", e); |
T | decode(String json, Class json decode try { return new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).readValue(json, clazz); } catch (IOException e) { throw new IllegalStateException(e); |
String | decodeCommandAsJson(final BsonInput bsonInput) decode Command As Json bsonInput.readInt32(); bsonInput.readInt32(); bsonInput.readInt32(); bsonInput.readInt32(); bsonInput.readInt32(); bsonInput.readCString(); bsonInput.readInt32(); bsonInput.readInt32(); ... |
T | deserialize(JsonReader reader, Class deserialize T t = GSON.fromJson(reader, type);
reader.close();
return t;
|
T | deserialize(String json, Class deserialize try { return objectMapper.readValue(json, clazz); } catch (IOException e) { e.printStackTrace(); return null; |
T | deserialize(String json, Class deserialize try { return objectMapper.readValue(json, targetType); } catch (IOException e) { throw new IllegalStateException("Failed to convert json to object", e); |
T | deserialize(String jsonData, Class deserialize if (jsonData == null) { return null; ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(jsonData, typeOfT); |
T | deserializeFromDataNode(JsonParser jp, DeserializationContext ctxt, String propertyName, TypeReference deserialize From Data Node if (jp.hasCurrentToken() && jp.getCurrentToken().equals(JsonToken.START_OBJECT)) { JsonNode dataNode = jp.readValueAs(JsonNode.class); if (dataNode.has(propertyName)) { return OBJECT_MAPPER.reader(typeReference).<T>readValue(dataNode.get(propertyName)); return null; throw ctxt.mappingException("Expected JSON object"); ... |