Skip to main content

Python 3-based commandline converter CSV → YAML ↔ JSON ↔ PLIST ↔ XML

Project description

yaplon

Convert between JSON, YAML and PLIST (binary and XML) in the commandline. Can be used in piping. Written in Python 3.9 (not 2.7 compatible).

Installation

pip3 install --user --upgrade yaplon
pip3 install --user --upgrade git+https://github.com/twardoch/yaplon

Usage

yaplon [c|j|p|x|y]2[j|p|x|y] -i input -o output [options]

Commands:

c2j  -i CSV -o JSON [-d DIALECT] [-k KEY] [-m] (minify)
c2p  -i CSV -o PLIST [-d DIALECT] [-k KEY] [-m] (minify)
c2x  -i CSV -o XML [-d DIALECT] [-k KEY] [-m] (minify) [-S] (simple XML)
c2y  -i CSV -o YAML [-d DIALECT] [-k KEY] [-m] (minify)
j2p  -i JSON -o PLIST [-b] (make binary PLIST)
j2x  -i JSON -o XML [-m] (minify) [-S] (simple XML)
j2y  -i JSON -o YAML [-m] (minify YAML)
p2j  -i PLIST -o JSON [-m] (minify) [-b] (keep binary)
p2x  -i PLIST -o XML [-m] (minify) [-S] (simple XML)
p2y  -i PLIST -o YAML [-m] (minify YAML)
x2j  -i XML -o JSON [-m] (minify) [-b] (keep binary)
x2p  -i XML -o PLIST [-b] (make binary PLIST)
x2y  -i XML -o YAML [-m] (minify YAML)
y2j  -i YAML -o JSON [-m] (minify) [-b] (keep binary)
y2p  -i YAML -o PLIST [-b] (make binary PLIST)
y2x  -i YAML -o XML [-m] (minify) [-S] (simple XML)

Also installs direct CLI tools that correspond to the commands:

  • csv22json, csv22plist, csv22xml, csv22yaml,
  • json22plist, json22xml, json22yaml,
  • plist22json, plist22xml, plist22yaml,
  • xml22json, xml22plist, xml22yaml,
  • yaml22json, yaml22plist, yaml22xml

Note that they have 22 rather than 2 in the filenames, so they don’t conflict with other similar (often single-purpose) tools that you may have.

Examples

JSON to YAML

File to file via the dedicated CLI tool:

$ json22yaml -i input.json -o output.yaml

Using pipe redirects, via the yaplon tool with j2y command:

$ yaplon j2y < input.json > output.yaml

Read file, output minified to stdout, via the Python 3 module

$ python3 -m yaplon j2y -m -i input.json

PLIST to JSON

Read PLIST file, output minified JSON file, via the dedicated CLI tool.

$ plist22json -m -i input.plist > output.json

Read plist file, output minified JSON to stdout, via the yaplon tool with p2j command.

$ yaplon p2j -m -i input.plist

Changelog

  • 1.5.6: switched to Unicode output in JSON, refactoring
  • 1.5.3: added CSV reading and limited XML read/write
  • 1.2.7: removed obsolete plistlib.Data reference
  • 1.2.3: bugfix
  • 1.2.1: added support for orderedattrdict.AttrDict
  • 1.1.0: added -s for sorting data
  • 1.0.8: initial public release

Links

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

yaplon-1.5.6.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

yaplon-1.5.6-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file yaplon-1.5.6.tar.gz.

File metadata

  • Download URL: yaplon-1.5.6.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for yaplon-1.5.6.tar.gz
Algorithm Hash digest
SHA256 54d09a872b34706c706bd9fc47e270d90093f48ab2ed25388a6dd9456c572142
MD5 c5c468a4791ed77bbc1b9520a3985ac0
BLAKE2b-256 10a3c68167122e79ec392ee3b8f7bd29bfb6c830aafcfaad4b40ae58549776fb

See more details on using hashes here.

Provenance

File details

Details for the file yaplon-1.5.6-py3-none-any.whl.

File metadata

  • Download URL: yaplon-1.5.6-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for yaplon-1.5.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0a2b72ed34ec01f0070f34cc034a4a05b680baf946d1e07fd9013fe81436ac45
MD5 a0621c8227b5d7127624c8807e201d42
BLAKE2b-256 e1aae35a45f0a9d4116b3a0b13ac86a829cdd6daf43cc509e4a526a4db29835f

See more details on using hashes here.

Provenance

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