Package org.springframework.boot.json
Class JacksonJsonParser
- java.lang.Object
- org.springframework.boot.json.AbstractJsonParser
- org.springframework.boot.json.JacksonJsonParser
- All Implemented Interfaces:
JsonParser
public class JacksonJsonParser extends AbstractJsonParser
Thin wrapper to adapt Jackson 2ObjectMapper
toJsonParser
.- See Also:
JsonParserFactory
Constructor Summary
Constructors Constructor Description JacksonJsonParser()
Creates an instance with a defaultObjectMapper
that is created lazily.JacksonJsonParser(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Creates an instance with the specifiedObjectMapper
.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Object>
parseList(String json)
Parse the specified JSON string into a List.Map<String,Object>
parseMap(String json)
Parse the specified JSON string into a Map.Methods inherited from class org.springframework.boot.json.AbstractJsonParser
parseList, parseMap, trimParse, tryParse
Constructor Detail
JacksonJsonParser
public JacksonJsonParser(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Creates an instance with the specifiedObjectMapper
.- Parameters:
objectMapper
- the object mapper to use
JacksonJsonParser
public JacksonJsonParser()
Creates an instance with a defaultObjectMapper
that is created lazily.
Method Detail
parseMap
public Map<String,Object> parseMap(String json)
Description copied from interface:JsonParser
Parse the specified JSON string into a Map.- Parameters:
json
- the JSON to parse- Returns:
- the parsed JSON as a map
parseList
public List<Object> parseList(String json)
Description copied from interface:JsonParser
Parse the specified JSON string into a List.- Parameters:
json
- the JSON to parse- Returns:
- the parsed JSON as a list