mirror of
https://github.com/rafagafe/tiny-json.git
synced 2025-03-12 19:25:30 +00:00
Update tiny-json.c
fix for json_getProperty not finding the object if it's the first element.
This commit is contained in:
parent
025cdde5f2
commit
6fcbc470e6
@ -41,6 +41,9 @@ typedef struct jsonStaticPool_s {
|
||||
|
||||
/* Search a property by its name in a JSON object. */
|
||||
json_t const* json_getProperty( json_t const* obj, char const* property ) {
|
||||
if ( obj->name && !strcmp( obj->name, property ) ) {
|
||||
return obj;
|
||||
}
|
||||
json_t const* sibling;
|
||||
for( sibling = obj->u.c.child; sibling; sibling = sibling->sibling )
|
||||
if ( sibling->name && !strcmp( sibling->name, property ) )
|
||||
|
Loading…
Reference in New Issue
Block a user