codegear / json-formatter
用于美化打印JSON字符串的命令行工具,便于人阅读
1.0.2
2018-07-29 00:00 UTC
Requires
- php: >=7.0.0
This package is auto-updated.
Last update: 2024-09-29 05:29:35 UTC
README
PHP编写的命令行工具,用于美化打印JSON字符串,便于人阅读。
https://whitephp.net/2018/07/31/jf-cli-json-formatter.html
需求
PHP版本需至少为PHP 7.0.0。
安装
使用 Composer 全局安装
$ composer global require codegear/json-formatter
使用方法
在命令行中
格式化文件 data.json 并输出到屏幕
$ jf data.json
格式化文件 data.json 并保存到另一个文件 data_formatted.json
$ jf data.json > data_formatted.json
在VIM中
格式化当前文件
:%!jf %
或在 vimrc 中添加快捷键
nnoremap <Leader>jf :%!jf %<CR>