Press "Enter" to skip to content

Month: October 2017

在OpenWrt/LEDE系统中处理JSON

在OpenWrt/LEDE系统中处理JSON的方法,这里记录一下。

假设有一个JSON文件

cat /etc/ss.json 
{
	"server": "8.8.8.8",
	"server_port": 443,
	"local_address": "0.0.0.0",
	"local_port": 7070,
	"password": "fuckgfang",
	"method": "aes_128_ctr",
	"timeout": "60",
	"protocol": "auth_aes128_sha1",
	"fast_open": false
}

处理方式1

$ jsonfilter -i /etc/ss.json -e "@.server"
8.8.8.8

$ CONF=/etc/ss.json
$ a=$(jsonfilter -i $CONF -e "@.server")
$ echo $a
8.8.8.8
1 Comment