Skip to content

Commit 75d57ad

Browse files
committed
Add json_object_value_name().
1 parent f4f3246 commit 75d57ad

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

json_parser.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,12 @@ const json_value_t *json_object_prev_value(const json_value_t *val,
11621162
return &list_entry(pos->prev, json_member_t, list)->value;
11631163
}
11641164

1165+
const char *json_object_value_name(const json_value_t *val,
1166+
const json_object_t *obj)
1167+
{
1168+
return list_entry(val, json_member_t, value)->name;
1169+
}
1170+
11651171
static const json_value_t *__json_object_insert(const char *name,
11661172
int type, va_list ap,
11671173
struct list_head *pos,

json_parser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ const char *json_object_prev_name(const char *name,
4242
const json_object_t *obj);
4343
const json_value_t *json_object_prev_value(const json_value_t *val,
4444
const json_object_t *obj);
45+
const char *json_object_value_name(const json_value_t *val,
46+
const json_object_t *obj);
4547
const json_value_t *json_object_append(json_object_t *obj,
4648
const char *name,
4749
int type, ...);

0 commit comments

Comments
 (0)