spring-geode/src/main/java/org/springframework/geode/data/json/converter/support/JacksonJsonToObjectConverter.java
/**
	 * Converts from {@link String JSON} to an {@link Object} (POJO) using Jackson's {@link ObjectMapper}.
	 *
	 * @param json {@link String} containing {@literal JSON} to convert.
	 * @return an {@link Object} (POJO) converted from the given {@link String JSON}.
	 * @see #getObjectMapper()
	 */
Converts from  String JSON to an  Object (POJO) using Jackson's  ObjectMapper.
@param json  String containing  JSON to convert.
@return an  Object (POJO) converted from the given  String JSON.
Converts from String JSON to an Object ( POJO ) using Jackson ' s ObjectMapper . @param json String containing JSON to convert . @return an Object ( POJO ) converted from the given String JSON .
@Override
	public @Nullable Object convert(@Nullable String json) {
		if (StringUtils.hasText(json)) {
			String objectTypeName = null;
			try {
				ObjectMapper objectMapper = getObjectMapper();
				JsonNode jsonNode = objectMapper.readTree(json);
				if (isPojo(jsonNode)) {
					return ((POJONode) jsonNode).getPojo();
				}
				else {
					Assert.state(jsonNode.isObject(), () -> String.format("The JSON [%s] must be an object", json));
					Assert.state(jsonNode.has(AT_TYPE_FIELD_NAME),
						() -> String.format("The JSON object [%1$s] must have an '%2$s' metadata field",
							json, AT_TYPE_FIELD_NAME));
					objectTypeName = jsonNode.get(AT_TYPE_FIELD_NAME).asText();
					Class<?> objectType =
						ClassUtils.forName(objectTypeName, Thread.currentThread().getContextClassLoader());
					return objectMapper.readValue(json, objectType);
				}
			}
			catch (ClassNotFoundException cause) {
				throw new MappingException(String.format("Failed to map JSON [%1$s] to an Object of type [%2$s]",
					json, objectTypeName), cause);
			}
			catch (JsonProcessingException cause) {
				throw new DataRetrievalFailureException(String.format("Failed to read JSON [%s]", json), cause);
			}
		}
		return null;
	}
@ Override public @ Nullable Object convert ( @ Nullable String json ) { if ( StringUtils . hasText ( json ) ) { String objectTypeName = null ; try { ObjectMapper objectMapper = getObjectMapper ( ) ; JsonNode jsonNode = objectMapper . readTree ( json ) ; if ( isPojo ( jsonNode ) ) { return ( ( POJONode ) jsonNode ) . getPojo ( ) ; } else { Assert . state ( jsonNode . isObject ( ) , ( ) -> String . format ( "The JSON [%s] must be an object" , json ) ) ; Assert . state ( jsonNode . has ( AT_TYPE_FIELD_NAME ) , ( ) -> String . format ( "The JSON object [%1$s] must have an '%2$s' metadata field" , json , AT_TYPE_FIELD_NAME ) ) ; objectTypeName = jsonNode . get ( AT_TYPE_FIELD_NAME ) . asText ( ) ; Class < ? > objectType = ClassUtils . forName ( objectTypeName , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; return objectMapper . readValue ( json , objectType ) ; } } catch ( ClassNotFoundException cause ) { throw new MappingException ( String . format ( "Failed to map JSON [%1$s] to an Object of type [%2$s]" , json , objectTypeName ) , cause ) ; } catch ( JsonProcessingException cause ) { throw new DataRetrievalFailureException ( String . format ( "Failed to read JSON [%s]" , json ) , cause ) ; } } return null ; }
Converts from {@link String JSON} to an {@link Object} (POJO) using Jackson's {@link ObjectMapper}.
Converts from { @link String JSON } to an { @link Object } ( POJO ) using Jackson ' s { @link ObjectMapper } .