@@ -19,7 +19,7 @@ To use this extension on Maven-based projects, use following dependency:
19
19
<dependency >
20
20
<groupId >com.fasterxml.jackson.dataformat</groupId >
21
21
<artifactId >jackson-dataformat-csv</artifactId >
22
- <version >2.4.0 </version >
22
+ <version >2.5.3 </version >
23
23
</dependency >
24
24
```
25
25
@@ -119,7 +119,7 @@ while (it.hasNext()) {
119
119
}
120
120
```
121
121
122
- ### With column names from first row
122
+ ## With column names from first row
123
123
124
124
But if you want a "data as Map" approach, with data that has expected column names as the first row,
125
125
followed by data rows, you can iterate over entries quite conveniently as well.
@@ -169,6 +169,28 @@ This means that using earlier CSV data example, parser would instead expose it s
169
169
170
170
This is useful if functionality expects a single ("JSON") Array; this was the case for example when using ` ObjectReader.readValues() ` functionality.
171
171
172
+ ## Configuring ` CsvSchema `
173
+
174
+ Besides defining how CSV columns are mapped to and from Java Object properties, ` CsvSchema ` also
175
+ defines low-level encoding details. These are details be changed by using various ` withXxx() ` and
176
+ ` withoutXxx ` methods (or through associated ` CsvSchema.Builder ` object); for example:
177
+
178
+ ``` java
179
+ CsvSchema schema = mapper. schemaFor(Pojo . class);
180
+ // let's do pipe-delimited, not comma-delimited
181
+ schema = schema. withColumnSeparator(' |' )
182
+ // and write Java nulls as "NULL" (instead of empty string)
183
+ .withNullValue(" NULL" )
184
+ // and let's NOT allow escaping with backslash ('\')
185
+ .withoutEscapaChar()
186
+ ;
187
+ ObjectReader r = mapper. readerFor(Pojo . class). with(schema);
188
+ Pojo value = r. readValue(csvInput);
189
+ ```
190
+
191
+
192
+ For full description of all configurability, please see [ ../wiki/CsvSchema] .
193
+
172
194
# Documentation
173
195
174
196
* [ Wiki] ( ../../wiki ) (includes javadocs)
0 commit comments