json-fix
Command line utility for parsing and fixing json with commons errors like missing ""
Last updated 2 years ago by danielpanpm .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install json-fix 
SYNC missed versions from official npm registry.

json-fix

Command line utility for parsing and fixing json with commons errors like missing ""

Installation

$ npm install json-fix --global

Options

$ json-fix --help

  Usage: index [options] [file ...]

  Options:

    -V, --version                       output the version number
    -s, --spaces <amount>               Number of spaces for indentation
    -i, --inflection <none|pascalcase>  Inflection type, defaults to none
    --no-sort                           Don't sort
    -h, --help                          output usage information

Examples

Passing files to arguments

$ json-fix a.json
// a.json
{ a: "hello",
 b: "world",
}

converts to

// a.json
{
    "a": "hello",
    "b": "world"
}

Passing json from stdin

$ echo { a: 3, b: 2 } | json-fix
{
  "a": 3,
  "b": 2
}

IDEs configuration

Spacemacs/Emacs

  (defun fix-errors-with-json-fix-4 ()
    (interactive)
    (shell-command-to-string (format "json-fix -s 4 %s" buffer-file-name))
    (revert-buffer-no-confirm))
  (defun fix-errors-with-json-fix-2 ()
    (interactive)
    (shell-command-to-string (format "json-fix -s 2 --no-sort %s" buffer-file-name))
    (revert-buffer-no-confirm))
  (spacemacs/set-leader-keys "oj" 'fix-errors-with-json-fix-4)
  (spacemacs/set-leader-keys "ok" 'fix-errors-with-json-fix-2)

Current Tags

  • 0.7.0                                ...           latest (2 years ago)

10 Versions

  • 0.7.0                                ...           2 years ago
  • 0.6.1                                ...           2 years ago
  • 0.6.0                                ...           2 years ago
  • 0.5.1                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.1                                ...           2 years ago
  • 0.4.0                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Downloads
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 1
Last Month 9
Dependencies (4)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |