Closed ldyoungGod closed 3 months ago
The szName
was modified after being added to the document, so the string should be copied using yyjson_mut_obj_add_strcpy()
.
See: https://github.com/ibireme/yyjson/blob/master/doc/API.md#api-for-string
这是来自QQ邮箱的假期自动回复邮件。 您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。
//code
include
include
include
include "yyjson.h"
int main(int argc, char argv[]) { yyjson_mut_doc doc = yyjson_mut_doc_new(NULL); yyjson_mut_val* root = yyjson_mut_obj(doc); yyjson_mut_doc_set_root(doc,root);
}
//real output { "vecObj": [ { "name": "obj3" }, { "name": "obj3" }, { "name": "obj3" } ] }
//should output { "vecObj": [ { "name": "obj1" }, { "name": "obj2" }, { "name": "obj3" } ] }