Class JsonLineMapper
java.lang.Object
org.springframework.batch.infrastructure.item.file.mapping.JsonLineMapper
- All Implemented Interfaces:
LineMapper<Map<String,
Object>>
Interpret a line as a JSON object and parse it up to a Map. The line should be a
standard JSON object, starting with "{" and ending with "}" and composed of
name:value
pairs separated by commas. Whitespace is ignored, e.g.
{ "foo" : "bar", "value" : 123 }The values can also be JSON objects (which are converted to maps):
{ "foo": "bar", "map": { "one": 1, "two": 2}}
- Author:
- Dave Syer, Mahmoud Ben Hassine
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a newJsonLineMapper
with a defaultJsonMapper
.JsonLineMapper
(tools.jackson.databind.json.JsonMapper jsonMapper) Create a newJsonLineMapper
with the providedJsonMapper
. -
Method Summary
-
Constructor Details
-
JsonLineMapper
public JsonLineMapper()Create a newJsonLineMapper
with a defaultJsonMapper
. -
JsonLineMapper
public JsonLineMapper(tools.jackson.databind.json.JsonMapper jsonMapper) Create a newJsonLineMapper
with the providedJsonMapper
.- Parameters:
jsonMapper
- the json mapper to use- Since:
- 6.0
-
-
Method Details