2013/3/20 Bastian Bittorf <[email protected]>

> with is the supposed way to do this, could'nt find
> any documentation, so we tried this:
>
> #!/bin/sh
> . /usr/share/libubox/jshn.sh
>
> JSON="$( wget -qO - "$URL" )"
> eval $( jshn -r "$JSON" )
>
> echo "Status is $JSON_VAR_status"
> echo "Number is: $JSON_TABLE1_number"
>
>
> ####
> Or is this too naiv?
> This is the JSON which gets parsed:
>
> {
>   "status": 200,
>   "msg": "ok",
>   "result": {
>     "number": "99",
>     "mac": "d85d4c9c2f1a",
>     "last_seen": 1363777473407
>   }
> }
>

Hi, recently we needed to deal with json and our primary try was JSHN.
Unfortunately we found it too hard to parse json. It's too verbose.

Our solution? Write our scripts in LUA. It's small and very powerful. It's
highly modularized, so, just install a lua-json module and voilĂ ! With its
concept of tables, it deals with json almost as natural as javascript does.

Cheers,
-- 
Jonh Wendell
http://www.bani.com.br
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to