Constructor and Description |
---|
JSONPathParser(JSONPathSpec flattenSpec,
com.fasterxml.jackson.databind.ObjectMapper mapper)
Constructor
|
Modifier and Type | Method and Description |
---|---|
List<String> |
getFieldNames()
Returns the fieldNames that we expect to see in parsed Maps, if known, or null otherwise.
|
Map<String,Object> |
parseToMap(String input)
Parse a String into a Map.
|
void |
setFieldNames(Iterable<String> fieldNames)
Set the fieldNames that you expect to see in parsed Maps.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
startFileFromBeginning
public JSONPathParser(JSONPathSpec flattenSpec, com.fasterxml.jackson.databind.ObjectMapper mapper)
flattenSpec
- Provide a path spec for flattening and field discovery.mapper
- Optionally provide an ObjectMapper, used by the parser for reading the input JSON.public List<String> getFieldNames()
Parser
getFieldNames
in interface Parser<String,Object>
public void setFieldNames(Iterable<String> fieldNames)
Parser
setFieldNames
in interface Parser<String,Object>
public Map<String,Object> parseToMap(String input)
Parser
parseToMap
in interface Parser<String,Object>
input
- JSON string. The root must be a JSON object, not an array.
e.g., {"valid": "true"} and {"valid":[1,2,3]} are supported
but [{"invalid": "true"}] and [1,2,3] are not.Copyright © 2011–2018. All rights reserved.