{"id":13752442,"url":"https://github.com/csvspecs/csv-json","last_synced_at":"2025-05-09T19:32:07.696Z","repository":{"id":75995123,"uuid":"152793101","full_name":"csvspecs/csv-json","owner":"csvspecs","description":"CSV ❤ JSON Format - Comma-Separated Values (CSV) Line-by-Line Records with JSON Encoding Rules - A Modern (Simple) Tabular Data Format incl. Arrays, Numbers, Booleans, Nulls, Nested Structures, Comments and More","archived":false,"fork":false,"pushed_at":"2018-10-18T12:48:20.000Z","size":22,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-03T09:03:58.387Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csvspecs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-10-12T18:34:31.000Z","updated_at":"2024-02-04T10:07:31.000Z","dependencies_parsed_at":"2024-01-17T15:02:45.495Z","dependency_job_id":"d96e6272-2ff5-4de8-a0b1-ee1f5e9713f7","html_url":"https://github.com/csvspecs/csv-json","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csvspecs%2Fcsv-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csvspecs%2Fcsv-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csvspecs%2Fcsv-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csvspecs%2Fcsv-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csvspecs","download_url":"https://codeload.github.com/csvspecs/csv-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224880776,"owners_count":17385367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T09:01:05.880Z","updated_at":"2024-11-16T05:30:32.449Z","avatar_url":"https://github.com/csvspecs.png","language":null,"readme":"# CSV \u003c3 JSON Format\r\n \r\n\r\n_CSV (Line-by-Line) Records with JSON Encoding Rules - A Modern (Simple) Tabular Data Format incl. Arrays, Numbers, Booleans, Nulls, Nested Structures, Comments and More_\r\n\r\n\r\n\r\n## CSV \u003c3 JSON By Example\r\n\r\n\r\n```\r\n# \"Vanilla\" CSV \u003c3 JSON\r\n\r\n1,\"John\",\"12 Totem Rd. Aspen\",true\r\n2,\"Bob\",null,false\r\n3,\"Sue\",\"Bigsby, 345 Carnival, WA 23009\",false\r\n```\r\n\r\nor\r\n\r\n```\r\n# \"Vanilla\" CSV \u003c3 JSON (Pretty Printed)\r\n\r\n1, \"John\", \"12 Totem Rd. Aspen\",            true\r\n2, \"Bob\",  null,                            false\r\n3, \"Sue\", \"Bigsby, 345 Carnival, WA 23009\", false\r\n```\r\n\r\nor\r\n\r\n```\r\n# CSV \u003c3 JSON with header / headers row\r\n\r\n\"id\",\"name\",\"address\",\"regular\"\r\n1,\"John\",\"12 Totem Rd. Aspen\",true\r\n2,\"Bob\",null,false\r\n3,\"Sue\",\"Bigsby, 345 Carnival, WA 23009\",false\r\n```\r\n\r\nor\r\n\r\n```\r\n# CSV \u003c3 JSON with values containing quotes and commas\r\n\r\n\"id\",\"name\",\"address\",\"regular\"\r\n1,\"John\",\"12 Totem Rd., Aspen\",true\r\n2,\"Bob\",null,false\r\n3,\"Sue\",\"\\\"Bigsby\\\", 345 Carnival, WA 23009\",false\r\n```\r\n\r\nor\r\n\r\n```\r\n# CSV \u003c3 JSON with array values\r\n\r\n1,\"directions\",[\"north\",\"south\",\"east\",\"west\"]\r\n2,\"colors\",[\"red\",\"green\",\"blue\"]\r\n3,\"drinks\",[\"soda\",\"water\",\"tea\",\"coffe\"]\r\n4,\"spells\",[]\r\n```\t\r\n\r\nor\r\n\r\n```\r\n# CSV with all kinds of values\r\n\r\n\"index\",\"value1\",\"value2\"\r\n\"number\",1,2\r\n\"boolean\",false,true\r\n\"null\",null,\"non null\"\r\n\"array of numbers\",[1],[1,2]\r\n\"simple object\",{\"a\": 1},{\"a\":1, \"b\":2}\r\n\"array with mixed objects\",[1,null,\"ball\"],[2,{\"a\": 10, \"b\": 20},\"cube\"]\r\n\"string with quotes\",\"a\\\"b\",\"alert(\\\"Hi!\\\")\"\r\n\"string with bell\u0026newlines\",\"bell is \\u0007\",\"multi\\nline\\ntext\"\r\n```\r\n\r\n\r\n\r\n## Frequently Asked Questions (FAQ) and Answers\r\n\r\n### Q: What's the recommended file type extension for CSV \u003c3 JSON files?\r\n\r\nThe recommended file format for CSV \u003c3 JSON files is `.csv` :-) or use `.json.csv` (to highlight \r\nthe fact of the JSON encoding rules).\r\n\r\n\r\n\r\n\r\n\r\n## Do-It-Yourself (DIY) - No CSV \u003c3 JSON Parser in Your Language? - Build Your Own \r\n\r\n\r\nBuild your own parser:\r\n\r\n- Read the input (e.g. string or file) line-by-line\r\n  - If the line is blank (only whitespace), skip the line.\r\n  - If the line starts with a hash mark (`#`), skip the comment line.\r\n  - Otherwise wrap the line in (`[]`) and pass along to the JSON parser :-).\r\n  \r\n  \r\nExample in Ruby:\r\n\r\n``` ruby\r\ndef parse( input )\r\n   records = []\r\n   input.each_line do |line|\r\n        \r\n      ##  note: chomp('') if is an empty string,\r\n      ##    it will remove all trailing newlines (e.g. \\n or \\r\\n) from the line\r\n      line = line.chomp( '' )\r\n      \r\n      ##  strip leading and trailing whitespaces (space and tab)\r\n      line = line.strip\r\n      \r\n      next if line.empty?             ## skip blank lines\r\n      next if line.start_with?( '#' ) ## skip comment lines\r\n        \r\n      ## note: auto-wrap in array e.g. with []\r\n      records \u003c\u003c JSON.parse( \"[#{line}]\" )\r\n    end\r\n    records\r\nend\r\n```\r\n\r\n\r\n\r\n## Inspiration / Heritage / Alternatives\r\n\r\n### JSON Array Line by Line\r\n\r\n- CSVJSON Format, see \u003chttp://csvjson.org\u003e\r\n  - What's differnt?\r\n    - No comments, comments, comments.\r\n    - Uses a (simple ad-hoc) inline (optional) header schema format e.g. `{\"field\":\"id\",\"type\":\"int\"},{\"field\":\"name\",\"type\":\"string\"}, ...`\r\n    \r\n    \r\n### JSON Value(s) Line by Line\r\n\r\n- JSON Lines, see \u003chttp://jsonlines.org\u003e\r\n- Newline Delimited JSON (NDJSON), see \u003chttp://ndjson.org\u003e\r\n\r\n\r\n\r\n## License\r\n\r\nThe CSV \u003c3 JSON format is dedicated to the public domain.\r\n\r\n\r\n\r\n## Request for Comments (RFC)\r\n\r\nPlease post your comments to the [wwwmake forum](http://groups.google.com/group/wwwmake).\r\nThanks!\r\n","funding_links":[],"categories":["CSV \u003c3 JSON"],"sub_categories":["Can I use \\_\\_? (RFC 4180 \"Strict\")"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsvspecs%2Fcsv-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsvspecs%2Fcsv-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsvspecs%2Fcsv-json/lists"}