Skip to content

Commit 5e6c13a

Browse files
authored
[Serializer] Add csv_headers label
1 parent d4f51e6 commit 5e6c13a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

components/serializer.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -1075,11 +1075,12 @@ Option Description D
10751075
``csv_escape_char`` Sets the escape character (at most one character) empty string
10761076
``csv_key_separator`` Sets the separator for array's keys during its ``.``
10771077
flattening
1078-
``csv_headers`` Sets the order of the header and data columns
1078+
``csv_headers`` Sets the order of the header and data columns ``[]``, inferred from input data's keys
10791079
E.g.: if ``$data = ['c' => 3, 'a' => 1, 'b' => 2]``
1080-
and ``$options = ['csv_headers' => ['a', 'b', 'c']]``
1080+
and ``$options = ['csv_headers' => ['Label A' => 'a',
1081+
'b', 'Label C' => 'c']]``
10811082
then ``serialize($data, 'csv', $options)`` returns
1082-
``a,b,c\n1,2,3`` ``[]``, inferred from input data's keys
1083+
``"Label A",b,"Label C"\n1,2,3``
10831084
``csv_escape_formulas`` Escapes fields containing formulas by prepending them ``false``
10841085
with a ``\t`` character
10851086
``as_collection`` Always returns results as a collection, even if only ``true``

0 commit comments

Comments
 (0)