Skip to main content

Convert list of json objects to csv with optional filters

Project description

Description

Converts a list of json objects to a csv with optional filtering, sorting and date formatting.

installation

This commands installs the package and an application script: json2csv.

pip install json-to-csv-filter

Usage

usage: json_to_csv.py [-h] [-i [INCLUDE ...]] [-e [EXCLUDE ...]] [-o [ORDER ...]] [-n [NUMBER]] [-d [DATE_FIELDS ...]] [-df [DATE_FORMAT]] [-l [LOCALE]] [infile] [outfile]

Convert list of json objects to csv

positional arguments:
  infile                Input file, defaults to STDIN
  outfile               Output file, defaults to STDOUT

optional arguments:
  -h, --help            show this help message and exit
  -i [INCLUDE ...], --include [INCLUDE ...]
                        Include fields, defaults to all
  -e [EXCLUDE ...], --exclude [EXCLUDE ...]
                        Exclude fields, defaults to none
  -o [ORDER ...], --order [ORDER ...]
                        Order fields, defaults to none
  -n [NUMBER], --number [NUMBER]
                        Number of records to process, defaults to all
  -d [DATE_FIELDS ...], --date-fields [DATE_FIELDS ...]
                        Date fields, defaults to none
  -df [DATE_FORMAT], --date-format [DATE_FORMAT]
                        Custom datetime format
  -l [LOCALE], --locale [LOCALE]
                        locale id, defaults to nld

See https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes for datetime format strings and https://babel.pocoo.org/en/latest/ for default nld locale datetime format

Examples

convert a json file to standard out

json2csv -i ais-messages.txt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

json_to_csv_filter-1.4.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

json_to_csv_filter-1.4.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file json_to_csv_filter-1.4.1.tar.gz.

File metadata

  • Download URL: json_to_csv_filter-1.4.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for json_to_csv_filter-1.4.1.tar.gz
Algorithm Hash digest
SHA256 5458230d7b5df03ca2cd44967dd2b2dbeb4717c8a5d8c209e46f7ce7cea3814e
MD5 e34fbd22cdb65aada07fc60464c9fd8f
BLAKE2b-256 af6fb9e7e501a9db18ba97aebb8841ce8a45861587113684e077353254eeed28

See more details on using hashes here.

File details

Details for the file json_to_csv_filter-1.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for json_to_csv_filter-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11c984d93068ae59ea0b845922f6c26184d20e1ef1b1c10f25dd340c39e8fb68
MD5 74d6ad215299f2b5ed28d27287b2df39
BLAKE2b-256 06b769262134e99a72a8dbfb1ffe6080a4f7e3a66c6df3625ec3ca69589d7ea7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page