Skip to content
Command-line tool to pretty-print JSON string for human readability by PHP.
PHP
Branch: master
Clone or download
Pull request Compare This branch is 1 commit behind fanlei:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
.gitignore
LICENSE
README.md
composer.json

README.md

jf: JSON Formatter

Command-line tool to pretty-print JSON string for human readability by PHP.

https://whitephp.net/2018/07/31/jf-cli-json-formatter.html

Requirements

PHP needs to be a minimum version of PHP 7.0.0.

Installation

Globally by using Composer:

$ composer global require codegear/json-formatter

Usage

In Command-Line

Format file data.json and output to screen:

$ jf data.json

Format file data.json and save to another file data_formatted.json:

$ jf data.json > data_formatted.json

In VIM

Format current file:

:%!jf %

or add a keymap in vimrc:

nnoremap <Leader>jf :%!jf %<CR>
You can’t perform that action at this time.