This repository was archived by the owner on Jan 22, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +306
-125
lines changed
main/java/com/fasterxml/jackson/dataformat/csv
test/java/com/fasterxml/jackson/dataformat/csv/deser Expand file tree Collapse file tree 4 files changed +306
-125
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,15 @@ CsvMapper mapper = new CsvMapper();
83
83
Pojo value = ... ;
84
84
CsvSchema schema = mapper. schemaFor(Pojo . class); // schema from 'Pojo' definition
85
85
String csv = mapper. writer(schema). writeValueAsString(value);
86
- Pojo result = mapper. readerFor(Pojo . class). with(schema). read(csv);
86
+ MappingIterator<Pojo > it = mapper. readerFor(Pojo . class). with(schema)
87
+ .readValues(csv);
88
+ // Either read them all one by one (streaming)
89
+ while (it. hasNextValue()) {
90
+ Pojo value = it. nextValue();
91
+ // ... do something with the value
92
+ }
93
+ // or, alternatively all in one go
94
+ List<Pojo > all = it. readAll();
87
95
```
88
96
89
97
## Data-binding without schema
@@ -235,7 +243,8 @@ Jackson supports following extension or variations:
235
243
# Limitations
236
244
237
245
* Due to tabular nature of ` CSV ` format, deeply nested data structures are not well supported.
238
- * Use of Tree Model (` JsonNode ` ) is supported, but only within limitations of ` CSv ` format.
246
+ * You can use ` @JsonUnwrapped ` to get around this
247
+ * Use of Tree Model (` JsonNode ` ) is supported, but only within limitations of ` CSV ` format.
239
248
240
249
# Future improvements
241
250
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ Project: jackson-dataformat-csv
11
11
(contributed by georgewfraser@github)
12
12
#130: Add fluent addColumns operation to CsvSchema.Builder
13
13
(contributed by Peter A)
14
+ #137: Inject "missing" trailing columns as `null`s
15
+ (`JsonParser.Feature.INSERT_NULLS_FOR_MISSING_COLUMNS`)
14
16
#139: Add `CsvParser.Feature.ALLOW_TRAILING_COMMA` to allow enforcing strict handling
15
17
(contributed by Nick B)
16
18
#142: Add methods for appending columns of a `CsvSchema` into another
You can’t perform that action at this time.
0 commit comments