Skip to content

Commit

Permalink
json: fix parsing json containing only single value
Browse files Browse the repository at this point in the history
Fix parsing simple json containing only 1 value without a name
.e.g. '"HelloWorld"' or '42'
  • Loading branch information
fAuernigg authored and sreimers committed Sep 13, 2021
1 parent ca222ea commit 641cfa3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/json/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,16 @@ static int _json_decode(const char **str, size_t *len,

if (**str == '\"')
inquot = true;

val.p = *str;
val.l = 0;
ws = 0;

if (!inobj && !inarray) {
val.l = *len;
if (array_entry(idx, &val, aeh, arg))
val.l = 0;
}

break;
}
}
Expand Down

0 comments on commit 641cfa3

Please sign in to comment.