json-pretty-parse-cli
Command line interface to unescape and format JSON data using stringify and parse
Last updated 8 months ago by haroun .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install json-pretty-parse-cli 
SYNC missed versions from official npm registry.

json-pretty-parse-cli Build Status

Command line interface to unescape and format JSON data using stringify and parse

When I need to check a JSON message from a log entry, I often get an escaped string with no spaces, no new lines. Then the journey begin, I open a text-editor, replace all escaped quotes, open a new tab with a JSON formatted, copy/paste the unescaped JSON, format, copy/paste the result back to my text-editor, I'm good to go.

With jsonpp, first I use JSON.stringify and for each string entries with escaped strings, I do a JSON.parse using the replacer function. This may not be the fastest way to do it, but it seems solid so far.

If you need a command to unescape and format a JSON string, jsonpp is your man or woman.

Install

$ npm install --global json-pretty-parse-cli

If you don't want to install the package globally, you can use npx instead

$ npx @haroun/json-pretty-parse-cli

Usage

$ jsonpp --help

  Usage
    $ jsonpp [--space] <string>
    $ echo <string> | jsonpp [--space]

  Options
    -s, --space Space

  Examples
    $ jsonpp '{"number":42,"string":"string"}'
    {
      "number": 42,
      "string": "string"
    }

    $ jsonpp -s 4 '{\"number\":42,\"string\":\"string\"}'
    {
        "number": 42,
        "string": "string"
    }

    $ echo '{\\\"number\\":42,\\\"string\\\":\\\"string\\\"}' | jsonpp
    {
      "number": 42,
      "string": "string"
    }

    $ echo '{"number":42,"string":"string"}' | jsonpp -s 4
    {
        "number": 42,
        "string": "string"
    }

License

MIT © Harouna Traore

Current Tags

  • 2.0.0                                ...           latest (8 months ago)

3 Versions

  • 2.0.0                                ...           8 months ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |