summaryrefslogtreecommitdiffstats
path: root/misc/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc/json.c')
-rw-r--r--misc/json.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/misc/json.c b/misc/json.c
index d25e0f55c8..608cfad861 100644
--- a/misc/json.c
+++ b/misc/json.c
@@ -300,12 +300,15 @@ static int json_append(bstr *b, const struct mpv_node *src, int indent)
bstr_xappend_asprintf(NULL, b, "%"PRId64, src->u.int64);
return 0;
case MPV_FORMAT_DOUBLE: {
- const char *px = isfinite(src->u.double_) ? "" : "\"";
+ const char *px = (isfinite(src->u.double_) || indent == 0) ? "" : "\"";
bstr_xappend_asprintf(NULL, b, "%s%f%s", px, src->u.double_, px);
return 0;
}
case MPV_FORMAT_STRING:
- write_json_str(b, src->u.string);
+ if (indent == 0)
+ APPEND(b, src->u.string);
+ else
+ write_json_str(b, src->u.string);
return 0;
case MPV_FORMAT_NODE_ARRAY:
case MPV_FORMAT_NODE_MAP: {