diff --git a/json.c b/json.c index c5b7cf6c..53f714f4 100644 --- a/json.c +++ b/json.c @@ -95,4 +95,22 @@ json_object *parse(FILE *f, json_object *current) { return new_object(JSON_FALSE, current); } + + if (c == ',') { + if (current->parent == NULL || + (current->parent->type != JSON_ARRAY || + current->parent->type != JSON_HASH)) { + json_error(", not in array or hash"); + } + + return parse(f, current); + } + + if (c == ':') { + if (current->parent == NULL || current->parent->type != JSON_HASH) { + json_error(": not in hash"); + } + + return parse(f, current); + } }