lake@localhost:~/tmp/huaqing$ cat shell-json.sh
#!/bin/bash
### try to get url link after url lable in json string through shell/sed
example_json={"rv":0,flag:1,"url":"http://www.xxx.com","msg":"test"}
parse_json(){
echo "${1//\"/}" | sed "s/.*$2:\([^,}]*\).*/\1/"
}
echo $example_json
value=$(parse_json $example_json "url")
echo "url is "$value
lake@localhost:~/tmp/huaqing$
lake@localhost:~/tmp/huaqing$ sh shell-json.sh
{rv:0,flag:1,url:http://www.xxx.com,msg:test}
url is http://www.xxx.com
lake@localhost:~/tmp/huaqing$