|
@@ -8,7 +8,7 @@ fi
|
|
|
|
|
|
# If method undefined, find the first one that is installed
|
|
|
if [[ -z "$JSONTOOLS_METHOD" ]]; then
|
|
|
- for JSONTOOLS_METHOD in node python ruby; do
|
|
|
+ for JSONTOOLS_METHOD in node python3 ruby; do
|
|
|
# If method found, break out of loop
|
|
|
(( $+commands[$JSONTOOLS_METHOD] )) && break
|
|
|
# Otherwise unset the variable
|
|
@@ -45,12 +45,12 @@ case "$JSONTOOLS_METHOD" in
|
|
|
xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"
|
|
|
}
|
|
|
;;
|
|
|
- python)
|
|
|
+ python3)
|
|
|
function pp_json() {
|
|
|
- python -c 'import sys; del sys.path[0]; import runpy; runpy._run_module_as_main("json.tool")'
|
|
|
+ python3 -c 'import sys; del sys.path[0]; import runpy; runpy._run_module_as_main("json.tool")'
|
|
|
}
|
|
|
function is_json() {
|
|
|
- python -c '
|
|
|
+ python3 -c '
|
|
|
import sys; del sys.path[0];
|
|
|
import json
|
|
|
try:
|
|
@@ -61,14 +61,14 @@ except ValueError:
|
|
|
'
|
|
|
}
|
|
|
function urlencode_json() {
|
|
|
- python -c '
|
|
|
+ python3 -c '
|
|
|
import sys; del sys.path[0];
|
|
|
from urllib.parse import quote_plus
|
|
|
print(quote_plus(sys.stdin.read()))
|
|
|
'
|
|
|
}
|
|
|
function urldecode_json() {
|
|
|
- python -c '
|
|
|
+ python3 -c '
|
|
|
import sys; del sys.path[0];
|
|
|
from urllib.parse import unquote_plus
|
|
|
print(unquote_plus(sys.stdin.read()))
|