Create a new empty object with a reference count of 1. The caller of this object initially has sole ownership. Remember, when using json_object_object_add or json_object_array_put_idx, ownership will transfer to the object/array. Call json_object_get if you want to maintain shared ownership or also add this object as a child of multiple objects or arrays. Any ownerships you acquired but did not transfer must be released through json_object_put.
@Liu-Ameng
json-c 的 API 中如是写到:
是不是意味着我们在代码中每使用一次
json_object_get
函数,就应当伴随着json_object_put
?用一段代码测试看看?