Skip to main content

Utilities for working with toml files

Project description

jetblack-tomlutils

Some utilities for working with toml files.

Usage

Install with pip:

$ pip install jetblack-tomlutils

toml2json

To convert toml to JSON:

usage:
    tom2json [<input> [<output]]

    input/output: either a path or '-' for stdin/stdout

examples:
    $ toml2json < pyproject.toml > pyproject.json
    $ toml2json pyproject.toml > pyproject.json
    $ toml2json pyproject.toml - > pyproject.json
    $ toml2json pyproject.toml pyproject.json
    $ cat pyproject.toml | toml2json
    $ cat pyproject.toml | toml2json -

json2toml

To convert JSON to toml:

usage:
    json2toml [<input> [<output]]

    input/output: either a path or '-' for stdin/stdout

examples:
    $ json2toml < pyproject.json
    $ json2toml pyproject.json
    $ cat pyproject.toml | json2toml
    $ cat pyproject.toml | json2toml -

jsonget

To query JSON

You can query JSON using a JSON Pointer

usage:
    jsonget <json-pointer> [<input> [<output>]]

    json-pointer: a valid JSON Pointer path
    input/output: either a path or '-' for stdin/stdout

examples:
    $ toml2json pyproject.toml | jsonget /tool/poetry/version

jsonset

To update JSON

You can update JSON using a JSON Pointer and a value

usage:
    jsonset <json-pointer> <json-value> [<input> [<output>]]

    json-pointer: a valid JSON Pointer path
    json-value: a value that can be parsed as JSON.
    input/output: either a path or '-' for stdin/stdout


examples:
    $ toml2json pyproject.toml | jsonset /tool/poetry/version '"1.2.3"'

Acknowledgements

This project is a trivial wrapper around the following projects:

Project details


Download files

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

Files for jetblack-tomlutils, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size jetblack_tomlutils-1.0.0-py3-none-any.whl (3.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size jetblack-tomlutils-1.0.0.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page