(bind-func json_print_type
(lambda (json:json_t*)
(let ((type (tref json 0)))
(cond ((= type JSON_OBJECT) (printf "JSON type: %s\n" "object"))
((= type JSON_ARRAY) (printf "JSON type: %s\n" "array"))
((= type JSON_STRING) (printf "JSON type: %s\n" "string"))
((= type JSON_INTEGER) (printf "JSON type: %s\n" "integer"))
((= type JSON_REAL) (printf "JSON type: %s\n" "real"))
((= type JSON_TRUE) (printf "JSON type: %s\n" "true"))
((= type JSON_FALSE) (printf "JSON type: %s\n" "false"))
((= type JSON_NULL) (printf "JSON type: %s\n" "null"))
(else (printf "JSON error: unsupported type.\n")))
(i64toi32 0))))