Advances the cursor of the reader to the `member_name` of the object at the current position.
You can use [[email protected]_value] and its wrapper functions to retrieve the value of the member; for instance:
```c json_reader_read_member (reader, "width"); width = json_reader_get_int_value (reader); ```
After reading the value, `json_reader_end_member()` should be called to reposition the cursor inside the reader, e.g.:
```c json_reader_read_member (reader, "author"); author = json_reader_get_string_value (reader); json_reader_end_member (reader);
json_reader_read_member (reader, "title"); title = json_reader_get_string_value (reader); json_reader_end_member (reader); ```
If the reader is not currently on an object, or if the `member_name` is not defined in the object, the reader will be put in an error state until [[email protected]_member] is called. This means that if used conditionally, [[email protected]_member] must be called on all branches:
```c if (!json_reader_read_member (reader, "title")) { g_propagate_error (error, json_reader_get_error (reader)); json_reader_end_member (reader); return FALSE; } else { const char *str_value = json_reader_get_string_value (reader); json_reader_end_member (reader);
// use str_value
return TRUE; } ```
this |
a reader |
member_name |
the name of the member to read |
`TRUE` on success, and `FALSE` otherwise |