🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

json-fix

Package Overview
Dependencies
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-fix

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

0.7.0
latest
Source
npm
Version published
Weekly downloads
3
50%
Maintainers
4
Weekly downloads
 
Created
Source

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)

Keywords

json

FAQs

Package last updated on 30 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts