fix: reset state for expecting key string in objects - json2tsv - JSON to TSV converter
(HTM) git clone git://git.codemadness.org/json2tsv
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit f689b5a0a309659de177c06bed733a0411f6ab02
(DIR) parent 137d638b66af74f1547584a560ae7a90875b4bf1
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 5 Aug 2024 12:00:37 +0200
fix: reset state for expecting key string in objects
Fixes an issue with the state machine still expecting a string to be an object
key, even after an (empty) object has been parsed.
This state is kept in the iskey variable, so reset it.
This happens for example with empty objects {}.
Test-case:
{"test":[["a",{},"b"]]}
Issue reported by Ben Collver, thanks!
Diffstat:
M json.c | 1 +
1 file changed, 1 insertion(+), 0 deletions(-)
---
(DIR) diff --git a/json.c b/json.c
@@ -262,6 +262,7 @@ escchr:
iskey = 1;
expect = EXPECT_STRING;
} else {
+ iskey = 0;
expect = EXPECT_VALUE;
}
break;