- printf '%s %s\n' "num:${number%.000000}" "$json_document"
-}
-
-json_value() {
- local value json_document="$json_document"
- json_type=""
-
- json_space
- case $json_document in
- \"*)
- value="$(json_string)" || return 1
- json_document="${value#* }"
- value="str:${value%% *}"
- json_type=string
- ;;
- [+-.0-9]*)
- value="$(json_number)" || return 1
- json_document="${value#* }"
- value="${value%% *}"
- json_type=number
- ;;
- "{"*)
- value="$(json_object)" || return 1
- json_document="${value#* }"
- value="obj:${value%% *}"
- json_type=object
- ;;
- "["*)
- value="$(json_array)" || return 1
- json_document="${value#* }"
- value="arr:${value%% *}"
- json_type=array
- ;;
- null*)
- json_document="${json_document#null}"
- value="null"
- json_type=null
- ;;
- true*)
- json_document="${json_document#true}"
- value="true"
- json_type=boolean
- ;;
- false*)
- json_document="${json_document#false}"
- value="false"
- json_type=boolean
- ;;
- esac
-
- printf "%s %s\n" "$value" "$json_document"