@@ -84,36 +84,6 @@ Looking for examples? Check out the Wiki: [json-2-csv Wiki](https://github.com/m
8484 * ` false ` uses the following keys:
8585 * ` ['specifications'] `
8686 * Note: This may result in CSV output that does not map back exactly to the original JSON. See #102 for more information.
87- * ` unwindArrays ` - Boolean - Should array values be "unwound" such that there is one line per value in the array?
88- * Default: ` false `
89- * Example:
90- ``` json
91- [
92- {
93- "_id" : {"$oid" : " 5cf7ca3616c91100018844af" },
94- "data" : {"category" : " Computers" , "options" : [{"name" : " MacBook Pro 15" }, {"name" : " MacBook Air 13" }]}
95- },
96- {
97- "_id" : {"$oid" : " 5cf7ca3616c91100018844bf" },
98- "data" : {"category" : " Cars" , "options" : [{"name" : " Supercharger" }, {"name" : " Turbocharger" }]}
99- }
100- ]
101- ```
102- * `true` will unwind the JSON to four objects, and therefore four lines of CSV values:
103- ```csv
104- _id.$oid,data.category,data.options.name
105- 5 cf7ca3616c91100018844af,Computers,MacBook Pro 15
106- 5 cf7ca3616c91100018844af,Computers,MacBook Air 13
107- 5 cf7ca3616c91100018844bf,Cars,Supercharger
108- 5 cf7ca3616c91100018844bf,Cars,Turbocharger
109- ```
110- * `false` will leave the values unwound and will convert the array as-is (when this option is used without expandArrayObjects):
111- ```csv
112- _id.$oid,data.category,data.options
113- 5 cf7ca3616c91100018844af,Computers,"[{""name"":""MacBook Pro 15""},{""name"":""MacBook Air 13""}]"
114- 5 cf7ca3616c91100018844bf,Cars,"[{""name"":""Supercharger""},{""name"":""Turbocharger""}]"
115- ```
116- * Note: This may result in CSV output that does not map back exactly to the original JSON.
11787 * ` keys ` - Array - Specify the keys (as strings) that should be converted.
11888 * Default: ` null `
11989 * If you have a nested object (ie. {info : {name: 'Mike'}}), then set this to [ 'info.name']
@@ -122,10 +92,43 @@ Looking for examples? Check out the Wiki: [json-2-csv Wiki](https://github.com/m
12292 * Default: ` true `
12393 * ` sortHeader ` - Boolean - Should the header keys be sorted in alphabetical order?
12494 * Default: ` false `
95+ * ` trimFieldValues ` - Boolean - Should the field values be trimmed?
96+ * Default: ` false `
12597 * ` trimHeaderFields ` - Boolean - Should the header fields be trimmed?
12698 * Default: ` false `
127- * `trimFieldValues` - Boolean - Should the field values be trimmed? (*in development*)
99+ * ` unwindArrays ` - Boolean - Should array values be "unwound" such that there is one line per value in the array?
100+ * Default: ` false `
101+ * Example:
102+ ``` json
103+ [
104+ {
105+ "_id" : {"$oid" : " 5cf7ca3616c91100018844af" },
106+ "data" : {"category" : " Computers" , "options" : [{"name" : " MacBook Pro 15" }, {"name" : " MacBook Air 13" }]}
107+ },
108+ {
109+ "_id" : {"$oid" : " 5cf7ca3616c91100018844bf" },
110+ "data" : {"category" : " Cars" , "options" : [{"name" : " Supercharger" }, {"name" : " Turbocharger" }]}
111+ }
112+ ]
113+ ```
114+ * `true` will unwind the JSON to four objects, and therefore four lines of CSV values:
115+ ```csv
116+ _id.$oid,data.category,data.options.name
117+ 5 cf7ca3616c91100018844af,Computers,MacBook Pro 15
118+ 5 cf7ca3616c91100018844af,Computers,MacBook Air 13
119+ 5 cf7ca3616c91100018844bf,Cars,Supercharger
120+ 5 cf7ca3616c91100018844bf,Cars,Turbocharger
121+ ```
122+ * `false` will leave the values unwound and will convert the array as-is (when this option is used without expandArrayObjects):
123+ ```csv
124+ _id.$oid,data.category,data.options
125+ 5 cf7ca3616c91100018844af,Computers,"[{""name"":""MacBook Pro 15""},{""name"":""MacBook Air 13""}]"
126+ 5 cf7ca3616c91100018844bf,Cars,"[{""name"":""Supercharger""},{""name"":""Turbocharger""}]"
127+ ```
128+ * Note: This may result in CSV output that does not map back exactly to the original JSON.
129+ * `useLocaleFormat` - Boolean - Should values be converted to a locale specific string?
128130 * Default: `false`
131+ * Note: If selected, values will be converted using `toLocaleString()` rather than `toString()`
129132
130133
131134For examples, please refer to the [json2csv API Documentation (Link)](https://github.com/mrodrig/json-2-csv/wiki/json2csv-Documentation)
0 commit comments