2json 中文文档教程
json2
将 json 文档转换为 grep-able 和 sed-able 行
install
# json2 was already taken
npm install -g 2json
usage
# json2 args
json2 [file] [< or_file]
# 2json
# -p flag pretty prints json
2json [file] [< or_file] [-p --pretty]
# get package name
basename $(json2 package.json | grep '/name')
# change package name and reconvert lines to json using 2json
json2 < package.json | sed 's@\(/name\)/.*@\1/new-name@' | 2json -p
escapes for json2/2json
的简单实用程序以下内容被转义——按照规则在引号字符串中:
- all forward slashes (/)
- all index brackets ([ or ])
- all strings that are just number characters (e.g. 00193425)
您必须转义字符串中的双引号,json2 会执行此操作。
backslash escapes for 2json
以下字符必须转义以处理使用反斜杠换行的问题,无论是否在引号中:
\ <- escape as \\
\n
\r
\f
notes
/ [] 由 json 行语法保留,如果在您的 json 中找到此类值,它们将用双引号引起来。
json2
simple utility for transforming json documents into grep-able and sed-able lines
install
# json2 was already taken
npm install -g 2json
usage
# json2 args
json2 [file] [< or_file]
# 2json
# -p flag pretty prints json
2json [file] [< or_file] [-p --pretty]
# get package name
basename $(json2 package.json | grep '/name')
# change package name and reconvert lines to json using 2json
json2 < package.json | sed 's@\(/name\)/.*@\1/new-name@' | 2json -p
escapes for json2/2json
The following are escaped--by being in quote strings, as per rules:
- all forward slashes (/)
- all index brackets ([ or ])
- all strings that are just number characters (e.g. 00193425)
You must escape double quotes in strings, json2 does this.
backslash escapes for 2json
The following characters must be escaped to handle issues with newlines using backslashes, whether in quotes or not:
\ <- escape as \\
\n
\r
\f
notes
/ [ ] are reserved by the json line grammar, if such values are found in your json, they will be quoted in double quotes.
更多
你可能也喜欢
- @0x-lerna-fork/otplease 中文文档教程
- @0x77/iqos.parser 中文文档教程
- @12stonechurch/react-native-video-controls 中文文档教程
- @1st-setup/openthermgateway 中文文档教程
- @2dine/promos-manager 中文文档教程
- @a-a-game-studio/aa-server 中文文档教程
- @aaronuu/react-layout 中文文档教程
- @abckey/webusb 中文文档教程
- @abcum/ember-location 中文文档教程
- @abihf/react-hook-form 中文文档教程