小编Mar*_*arz的帖子

jshn - 如何解析 json 包

我想知道如何在 openwrt 上轻松解析 json?

我有 jhsn 来解析 json,这是我的程序(.sh 脚本):

#download weather
wget "api.openweathermap.org/data/2.5/weather?id=2172797&appid=44db6a862fba0b067b1930da0d769e98"
#set variable wit json data
$weather=`cat weather?`
jshn -r "$weather"
Run Code Online (Sandbox Code Playgroud)

最后它显示:

json_init;
json_add_object 'coord';
json_add_double 'lon' 18.650000;
json_add_double 'lat' 50.300000;
json_close_object;
json_add_array 'weather';
json_add_object '0';
json_add_int 'id' 701;
json_add_string 'main' 'Mist';
json_add_string 'description' 'mist';
json_add_string 'icon' '50n';
json_close_object;
json_close_array;
json_add_string 'base' 'cmc stations';
json_add_object 'main';
json_add_double 'temp' 262.900000;
json_add_int 'pressure' 1033;
json_add_int 'humidity' 92;
json_add_double 'temp_min' 261.150000;
json_add_double 'temp_max' 263.750000;
json_close_object;
json_add_object 'wind';
json_add_double 'speed' 3.100000;
json_add_int …
Run Code Online (Sandbox Code Playgroud)

parsing json filtering openwrt

3
推荐指数
1
解决办法
3956
查看次数

标签 统计

filtering ×1

json ×1

openwrt ×1

parsing ×1