mirror of
https://github.com/parsecsv/csv-spec.git
synced 2026-02-19 00:46:40 +00:00
Update formatting and add rule 2.
This commit is contained in:
44
README.md
44
README.md
@@ -52,30 +52,42 @@ character used in any given input CSV-like formatted file/data.
|
||||
- **Header** — The first row is often used to contain the column names for all
|
||||
remaining rows. Header names would be used as key names when CSV data is
|
||||
converted to JSON for example.
|
||||
- **Line Break** — Line breaks in CSV files should be CRLF (`\r\n`). In
|
||||
examples the `¬` character will be used to visually display line breaks.
|
||||
- **Line Break** — Line breaks in CSV files should be CRLF (`\r\n`).
|
||||
|
||||
|
||||
## Rules
|
||||
|
||||
1. Each record is located on a separate line, each line ending with CRLF
|
||||
(`\r\n`). For example:
|
||||
_Where relevant examples include the CSV text version and the equivalent data
|
||||
in JSON format. Line breaks in the CSV examples are displayed as `¬`._
|
||||
|
||||
CSV:
|
||||
1. Each record is located on a separate line, each line ending with CRLF
|
||||
(`\r\n`). For example:
|
||||
|
||||
```csv
|
||||
aaa,bbb,ccc¬
|
||||
xxx,yyy,zzz¬
|
||||
```
|
||||
CSV:
|
||||
|
||||
JSON:
|
||||
```csv
|
||||
aaa,bbb,ccc¬
|
||||
xxx,yyy,zzz¬
|
||||
```
|
||||
|
||||
```json
|
||||
[
|
||||
["aaa", "bbb", "ccc"],
|
||||
["xxx", "yyy", "zzz"]
|
||||
]
|
||||
```
|
||||
JSON:
|
||||
|
||||
```json
|
||||
[
|
||||
["aaa", "bbb", "ccc"],
|
||||
["xxx", "yyy", "zzz"]
|
||||
]
|
||||
```
|
||||
|
||||
2. Though recommended, the last record in a file is not required to have a
|
||||
ending line break. For example:
|
||||
|
||||
CSV:
|
||||
|
||||
```csv
|
||||
aaa,bbb,ccc¬
|
||||
xxx,yyy,zzz
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Reference in New Issue
Block a user