Skip to content

Parsing an element following a closed object fails #2

@rdpoor

Description

@rdpoor

The following fails with a bad format error:

void test_regression(void) {
    mu_json_token_t tokens[5];
    const char *json = "[{\"x\": 0}, 1]";
    TEST_ASSERT_EQUAL_INT(5, mu_json_parse_c_str(tokens, 5, json, NULL));
}

The problem is that while parsing the '1', the parser thinks it is still parsing an element for the object, not the array, and fails because '1' is not a string.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions