jshn: do not collapse whitespace in json_load()
When running the test case below the $key variable holds "foo bar" instead of the expected "foo bar". -- 8< -- . /usr/share/libubox/jshn.sh json_init json_load '{ "key": "foo bar" }' json_get_var key key -- >8 -- Quote the output of the "jshn -r" backtick expression to prevent the shell from erroneously collapsing whitespace. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
parent
7ba1f8acd8
commit
bd388d2b6c
1 changed files with 1 additions and 1 deletions
|
@ -174,7 +174,7 @@ json_add_double() {
|
||||||
# functions read access to json variables
|
# functions read access to json variables
|
||||||
|
|
||||||
json_load() {
|
json_load() {
|
||||||
eval `jshn -r "$1"`
|
eval "`jshn -r "$1"`"
|
||||||
}
|
}
|
||||||
|
|
||||||
json_dump() {
|
json_dump() {
|
||||||
|
|
Loading…
Reference in a new issue