Json not found error

Trouble implementing custom block list , as json seems to not be found as a command

#!/bin/sh
json_init
json_load_file /etc/banip/banip.custom.feeds 2> /dev/null
json_add_object "vpn"
json_add_string "descr" "vpn CIDR"
json_add_string "url_4" "https://github.com/X4BNet/lists_vpn/blob/main/output/vpn/ipv4.txt"
json_add_string "rule_4" "/^[^#]/{print \$1\",\"}"
json_close_object
json_dump > /etc/banip/banip.custom.feeds
uci add_list banip.global.ban_feed="whatsapp"
uci commit banip
service banip restart

error:./vpn.sh: line 2: json_init: not found
./vpn.sh: line 4: json_add_object: not found
./vpn.sh: line 5: json_add_string: not found
./vpn.sh: line 6: json_add_string: not found
./vpn.sh: line 7: json_add_string: not found
./vpn.sh: line 8: json_close_object: not found
./vpn.sh: line 9: json_dump: not found

You have to load the JSON helper script first:

. /usr/share/libubox/jshn.sh

4 Likes

probably using wrong URL too, you want to grab the raw version of the file.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.