mirror of
https://github.com/hak5/wifipineapple-openwrt.git
synced 2025-10-29 16:57:19 +00:00
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25547 3c298f89-4303-0410-b956-a3cf2f4a3e73
20 lines
412 B
Plaintext
20 lines
412 B
Plaintext
. /lib/functions/jshn.sh
|
|
|
|
# generating json data
|
|
json_init
|
|
json_add_string "msg" "Hello, world!"
|
|
json_add_object "test"
|
|
json_add_int "testdata" "1"
|
|
json_close_object
|
|
MSG=`json_dump`
|
|
# MSG now contains: { "msg": "Hello, world!", "test": { "testdata": 1 } }
|
|
|
|
|
|
# parsing json data
|
|
json_load "$MSG"
|
|
json_select test
|
|
json_get_var var1 testdata
|
|
json_select ..
|
|
json_get_var var2 msg
|
|
echo "msg: $var2 - testdata: $var1"
|