nv-cli-json-fill
v1.0.7
Published
nv-cli-json-fill ==========
Downloads
3
Readme
nv-cli-json-fill
- creat code to build fixed-shape json
install
- npm install nv-cli-json-fill -g
usage
Usage: nv_cli_json_fill [options]
Options:
-H, --hint_name hint name, must be valid js identifier AND cant includes "$"
-i, --input input json default stdin
-r, --run_as_srv run as a http service
-q, --request match string IF using http service
-u, --url IF not empty, request will use the url ELSE will use internal unix_sock
-n, --ngx_user nginx user name, default www-data
-w, --workdir work dir ,dflt "./"
-h, --help usage
example
#mkdir WORKBENCH
#cd WORKBENCH
# nv_cli_json_fill -H my_jbuilder
// paste some json
[
null,
true,
false,
'\x00 a ÿ 我 𝑒 \b \t \n \f \r " \\ ',
0,
-0,
1.1,
-1.1,
1e+21,
-1e+21,
1.7976931348623157e+308,
-1.7976931348623157e+308,
[],
{},
{
'0': -0,
ary: [
0,
-0,
1.1,
-1.1,
1e+21,
-1e+21,
1.7976931348623157e+308,
-1.7976931348623157e+308
],
empty_ary: [],
EMPTY_A: {},
dict: {
n: null,
t: true,
f: false,
's s': '\x00 a ÿ 我 𝑒 \b \t \n \f \r " \\ '
}
}
]
// press ctrl+D
WORKBENCH# ls -l
total 4
-rw-r--r-- 1 root root 3468 Jul 11 16:21 my_jbuilder.js
# use it to cheange key
> const x=require("./my_jbuilder.js")
[Function: creat] { help: [Function (anonymous)] }
>
x({k18:'AAAAAAAA'})
/*
> x({k18:'AAAAAAAA'})
[
null,
true,
false,
'\x00 a ÿ 我 𝑒 \b \t \n \f \r " \\ ',
0,
0,
1.1,
-1.1,
1e+21,
-1e+21,
1.7976931348623157e+308,
-1.7976931348623157e+308,
[],
{},
{
'0': 0,
AAAAAAAA: [ //======================================>here
0,
0,
1.1,
-1.1,
1e+21,
-1e+21,
1.7976931348623157e+308,
-1.7976931348623157e+308
],
empty_ary: [],
EMPTY_A: {},
dict: {
n: null,
t: true,
f: false,
's s': '\x00 a ÿ 我 𝑒 \b \t \n \f \r " \\ '
}
}
]
>
*/
// check the value-name-map AND key-name-map USING .help()
> x.help()
[
${_1},
${b2},
${b3},
${s4},
${n5},
${n6},
${n7},
${n8},
${n9},
${n10},
${n11},
${n12},
[
],
{
},
{
${k16} : ${n17},
${k18} : [
${n20},
${n21},
${n22},
${n23},
${n24},
${n25},
${n26},
${n27}
],
${k28} : [
],
${k30} : {
},
${k32} : {
${k34} : ${_35},
${k36} : ${b37},
${k38} : ${b39},
${k40} : ${s41}
}
}
]
LICENSE
- ISC