PapaParse
PapaParse copied to clipboard
If the header row is indented, the first property name gets a leading space.
Here is a codepen. Notice that in the serialized output, the first property name is " a" (with a single space).
For me this is the expected behaviour as the source data contains also the space.
Hi !
I just encountered this behavior on a proper CSV file with header option set to true.
The first line of the CSV file is the header, as intended by the documentation, and the first column has the following content : key (no space, no quotes, only text).
The extracted field "key" from the result.data in the step function has the following value " key" (with a leading space) By injecting an extra column in the CSV first column, the same field, untouched, now has the value "key" (no leading space)
Hope this description will help ! 👍
@arnaud-brun could you share a code-sample (or event better a test-case) to reproduce the issue?
@pokoli
Just find out what was happening : CSV export operation of microsoft excel is wrong ! For unknown reason, it ads an extra space on the first element of the CSV file (which is not displayed by webstorm)
So your first answer was right: papaparse just acts as desired :) My bad !