Skip to content

invalid first character in key when json is written to string #198

@mrasco

Description

@mrasco

Please use English to communicate so that people from other countries can understand it.
Simple test:

// Add object to root
yyjson_mut_doc* m_docPtr = yyjson_mut_doc_new(NULL);
yyjson_mut_val* m_rootPtr = yyjson_mut_obj(m_docPtr);
yyjson_mut_doc_set_root(m_docPtr, m_rootPtr);
yyjson_mut_obj_add_obj(m_docPtr, m_rootPtr, "header");

// Write
const char* json = yyjson_mut_write(m_docPtr, 0, NULL);
if (json)
{
   free((void*)json);
}

Produces string:
{"\u0000eader":{}}

So the first char is replaced with \u0000
do I miss something or is it a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions