Coder Social home page Coder Social logo

yayson's Introduction

yayson

Yay, beautiful JSON on the command line!

yayson will take input on stdin and print pretty JSON with color in your terminal. It will come out something like this:

Example Yayson output

Example usage

cat my.json | yayson.py

or

curl -s http://www.example.com/my.json | yayson.py

--help output

usage: yayson.py [-h] [-i INDENT] [-c] [-s] [--version]

Yayson produces beautiful JSON

optional arguments:
  -h, --help            show this help message and exit
  -i INDENT, --indent INDENT
                        Number of spaces to indent with (default: 2)
  -c, --compact         Print JSON in compact mode, i.e. without spaces
                        between keys and values
  -s, --sort            Turn on key sorting
  --version             Print version information

Release information

0.3.1 (2015-03-23)

0.3.0 (2013-05-23)

0.2.0 (2013-04-08)

0.1.0 (2013-04-07)

  • Initial release

Releasing to PyPI

make release

Author

This project is maintained by Sebastian Dahlgren (GitHub | Twitter | LinkedIn)

yayson's People

Contributors

fiedzia avatar macropin avatar sebdah avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fiedzia

yayson's Issues

Support custom JSON encoder classes

Great work so far, thanks!

I'm calling json.dumpswith the clsargument to supply a custom JSON encoder class. It would be cool to accept this as parameter in yayson and hand it over instead of being forced to using the default one.

Support multiple JSON documents in output

Support multiple JSON documents in output:

{'tables': {}, 'global': {'daemon': False, 'check_interval': 3, 'dry_run': True, 'region': 'eu-west-1', 'aws_secret_access_key': None, 'config': '/Users/sebastian/Downloads/dyndyn.conf', 'aws_access_key_id': None}, 'logging': {'log_file': '~/Downloads/dynamic-dynamodb.log', 'log_level': 'info'}}
{"tables": {}, "global": {"daemon": false, "check_interval": 3, "dry_run": true, "region": "eu-west-1", "aws_secret_access_key": null, "config": "/Users/sebastian/Downloads/dyndyn.conf", "aws_access_key_id": null}, "logging": {"log_file": "~/Downloads/dynamic-dynamodb.log", "log_level": "info"}}

Library support

This would be more useful if it could be used as a library. If you move the pretty print function out from the main loop then it could be included in other projects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.