handle empty strings correctly - json2tsv - JSON to TSV converter | |
git clone git://git.codemadness.org/json2tsv | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 794f0a187d7ed4d72e60fbad7186e17f71ca23c4 | |
parent 78d6bc291c601ffda102b3572c642bd79f415449 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Mon, 14 Oct 2019 23:08:23 +0200 | |
handle empty strings correctly | |
reproduce: [""] | |
Diffstat: | |
M json2tsv.c | 4 +--- | |
1 file changed, 1 insertion(+), 3 deletions(-) | |
--- | |
diff --git a/json2tsv.c b/json2tsv.c | |
@@ -233,9 +233,7 @@ parsejson(void (*cb)(struct json_node *, size_t, const char… | |
case ']': | |
case '}': | |
case ',': | |
- if (v && | |
- (nodes[depth].type == TYPE_STRING || | |
- nodes[depth].type == TYPE_PRIMITIVE)) { | |
+ if (v || nodes[depth].type == TYPE_STRING) { | |
value[v] = '\0'; | |
cb(nodes, depth + 1, value); | |
v = 0; |