.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "CSVJSON" "1" "Jul 12, 2024" "2.0.1" "csvkit" .SH NAME csvjson \- csvjson Documentation .SH DESCRIPTION .sp Converts a CSV file into JSON or GeoJSON (depending on flags): .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C usage: csvjson [\-h] [\-d DELIMITER] [\-t] [\-q QUOTECHAR] [\-u {0,1,2,3}] [\-b] [\-p ESCAPECHAR] [\-z FIELD_SIZE_LIMIT] [\-e ENCODING] [\-L LOCALE] [\-S] [\-\-blanks] [\-\-null\-value NULL_VALUES [NULL_VALUES ...]] [\-\-date\-format DATE_FORMAT] [\-\-datetime\-format DATETIME_FORMAT] [\-H] [\-K SKIP_LINES] [\-v] [\-l] [\-\-zero] [\-V] [\-i INDENT] [\-k KEY] [\-\-lat LAT] [\-\-lon LON] [\-\-type TYPE] [\-\-geometry GEOMETRY] [\-\-crs CRS] [\-\-no\-bbox] [\-\-stream] [\-y SNIFF_LIMIT] [\-I] [FILE] Convert a CSV file into JSON (or GeoJSON). positional arguments: FILE The CSV file to operate on. If omitted, will accept input as piped data via STDIN. optional arguments: \-h, \-\-help show this help message and exit \-i INDENT, \-\-indent INDENT Indent the output JSON this many spaces. Disabled by default. \-k KEY, \-\-key KEY Output JSON as an object keyed by a given column, KEY, rather than as an array. All column values must be unique. If \-\-lat and \-\-lon are specified, this column is used as the GeoJSON Feature ID. \-\-lat LAT A column index or name containing a latitude. Output will be GeoJSON instead of JSON. Requires \-\-lon. \-\-lon LON A column index or name containing a longitude. Output will be GeoJSON instead of JSON. Requires \-\-lat. \-\-type TYPE A column index or name containing a GeoJSON type. Output will be GeoJSON instead of JSON. Requires \-\-lat and \-\-lon. \-\-geometry GEOMETRY A column index or name containing a GeoJSON geometry. Output will be GeoJSON instead of JSON. Requires \-\-lat and \-\-lon. \-\-crs CRS A coordinate reference system string to be included with GeoJSON output. Requires \-\-lat and \-\-lon. \-\-no\-bbox Disable the calculation of a bounding box. \-\-stream Output JSON as a stream of newline\-separated objects, rather than an as an array. \-y SNIFF_LIMIT, \-\-snifflimit SNIFF_LIMIT Limit CSV dialect sniffing to the specified number of bytes. Specify \(dq0\(dq to disable sniffing. \-I, \-\-no\-inference Disable type inference (and \-\-locale, \-\-date\-format, \-\-datetime\-format) when parsing CSV input. .ft P .fi .UNINDENT .UNINDENT .sp See also: \fI\%Arguments common to all tools\fP\&. .SH EXAMPLES .sp Convert veteran\(aqs education dataset to JSON keyed by state abbreviation: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ csvjson \-k \(dqState Abbreviate\(dq \-i 4 examples/realdata/FY09_EDU_Recipients_by_State.csv { \(dqAL\(dq: { \(dqState Name\(dq: \(dqALABAMA\(dq, \(dqState Abbreviate\(dq: \(dqAL\(dq, \(dqCode\(dq: 1.0, \(dqMontgomery GI Bill\-Active Duty\(dq: 6718.0, \(dqMontgomery GI Bill\- Selective Reserve\(dq: 1728.0, \(dqDependents\(aq Educational Assistance\(dq: 2703.0, \(dqReserve Educational Assistance Program\(dq: 1269.0, \(dqPost\-Vietnam Era Veteran\(aqs Educational Assistance Program\(dq: 8.0, \(dqTOTAL\(dq: 12426.0, \(dqj\(dq: null }, \(dq...\(dq: { \(dq...\(dq: \(dq...\(dq } } .ft P .fi .UNINDENT .UNINDENT .sp Convert locations of public art into GeoJSON: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ csvjson \-\-lat latitude \-\-lon longitude \-\-k slug \-\-crs EPSG:4269 \-i 4 examples/test_geo.csv { \(dqtype\(dq: \(dqFeatureCollection\(dq, \(dqbbox\(dq: [ \-95.334619, 32.299076986939205, \-95.250699, 32.351434 ], \(dqcrs\(dq: { \(dqtype\(dq: \(dqname\(dq, \(dqproperties\(dq: { \(dqname\(dq: \(dqEPSG:4269\(dq } }, \(dqfeatures\(dq: [ { \(dqtype\(dq: \(dqFeature\(dq, \(dqid\(dq: \(dqdcl\(dq, \(dqgeometry\(dq: { \(dqtype\(dq: \(dqPoint\(dq, \(dqcoordinates\(dq: [ \-95.30181, 32.35066 ] }, \(dqproperties\(dq: { \(dqtitle\(dq: \(dqDowntown Coffee Lounge\(dq, \(dqartist\(dq: null, \(dqdescription\(dq: \(dqIn addition to being the only coffee shop in downtown Tyler, DCL also features regular exhibitions of work by local artists.\(dq, \(dqinstall_date\(dq: null, \(dqaddress\(dq: \(dq200 West Erwin Street\(dq, \(dqtype\(dq: \(dqGallery\(dq, \(dqphoto_url\(dq: null, \(dqphoto_credit\(dq: null, \(dqlast_seen_date\(dq: \(dq2012\-03\-30\(dq } }, { \(dq...\(dq: \(dq...\(dq } ], \(dqcrs\(dq: { \(dqtype\(dq: \(dqname\(dq, \(dqproperties\(dq: { \(dqname\(dq: \(dqEPSG:4269\(dq } } } .ft P .fi .UNINDENT .UNINDENT .SH AUTHOR Christopher Groskopf and contributors .SH COPYRIGHT 2016, Christopher Groskopf and James McKinney .\" Generated by docutils manpage writer. .