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.
更多
你可能也喜欢
- 37bytes-react-d3-chart-graphs 中文文档教程
- 4sure-pipes 中文文档教程
- @0xgabi/portis-connector 中文文档教程
- @11ty/eleventy-navigation 中文文档教程
- @12core/date-input-polyfill 中文文档教程
- @20i/eslint-config 中文文档教程
- @7rabbit/tree 中文文档教程
- @7urtle/lambda 中文文档教程
- @aacassandra/jquery_upload_preview 中文文档教程
- @aaronpowell/azure-functions-nodejs-openapi 中文文档教程