Skip to main content

Json/Yaml/Toml Flattener

Project description

# PyCatJ|Y

Flatten out JSON|YAML|TOML files. Any number of files can be given on the command line. If no files are given, it expects input on STDIN.

For example:

$ ./catj.py catk.json catj.json catk.yaml
Processing: catk.json
movie.name: Interstellar
movie.year: 2014
movie.is_released: True
movie.director: Christopher Nolan
movie.genres.main: foo
movie.genres.secondary: bar
movie.genres.tertiary.foo: bar
movie.genres.tertiary.baz[0]: qux
movie.genres.tertiary.baz[1]: dux
movie.genres.tertiary.baz[2]: fux
movie.deep.nested.bit.cast[0]: Matthew McConaughey
movie.deep.nested.bit.cast[1]: Anne Hathaway
movie.deep.nested.bit.cast[2]: Jessica Chastain
movie.deep.nested.bit.cast[3]: Bill Irwin
movie.deep.nested.bit.cast[4]: Ellen Burstyn
movie.deep.nested.bit.cast[5]: Michael Caine
movie.deep.nested.of: data
movie.deep.neat: huh?

Processing: catj.json
movie.name: Interstellar
movie.year: 2014
movie.is_released: True
movie.director: Christopher Nolan
movie.cast[0]: Matthew McConaughey
movie.cast[1]: Anne Hathaway
movie.cast[2]: Jessica Chastain
movie.cast[3]: Bill Irwin
movie.cast[4]: Ellen Burstyn
movie.cast[5]: Michael Caine

Processing: catk.yaml
movie.deep.neat: huh?
movie.deep.nested.bit.cast[0]: Matthew McConaughey
movie.deep.nested.bit.cast[1]: Anne Hathaway
movie.deep.nested.bit.cast[2]: Jessica Chastain
movie.deep.nested.bit.cast[3]: Bill Irwin
movie.deep.nested.bit.cast[4]: Ellen Burstyn
movie.deep.nested.bit.cast[5]: Michael Caine
movie.deep.nested.of: data
movie.director: Christopher Nolan
movie.genres.main: foo
movie.genres.secondary: bar
movie.genres.tertiary.baz[0]: qux
movie.genres.tertiary.baz[1]: dux
movie.genres.tertiary.baz[2]: fux
movie.genres.tertiary.foo: bar
movie.is_released: True
movie.name: Interstellar
movie.year: 2014

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

pycatj-0.5.4.tar.gz (2.3 kB view hashes)

Uploaded Source

Supported by

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