On 6/15/26 14:23, Markus Armbruster wrote:
The error reported for

     {"abc":32,}

changes from

     JSON parse error, expecting value

to

     JSON parse error, key is not a string in object

I like the new one less.

This is check-qjson.c case /errors/invalid_dict_comma.

sure, this is due to conflating two separate error cases. Easily fixed (untested):

        /* Expecting object key */
        assert(qobject_type(entry->partial) == QTYPE_QDICT);
        if (token->type != JSON_STRING && token->type != JSON_INTERP) {
            parse_error(ctxt, token, "expecting value");
            return NULL;
        }

        key_obj = parse_begin_value(ctxt, token);
        if (!key_obj) {
            /* Parse error already reported */
        } else if (qobject_type(key_obj) != QTYPE_QSTRING) {
            /* An interpolation was valid syntactically but not %s */
            parse_error(ctxt, token, "key is not a string in object");
        } else {
            /* Store key in a special entry on the stack */
            push_entry(ctxt, key_obj, END_OF_KEY);
        }

Paolo


Reply via email to