### Method

# Json Reader read_member

since: 0.12

#### Declaration [src]

    gboolean
    json_reader_read_member (
      JsonReader* reader,
      const gchar* member_name
    )

#### Description [src]

Advances the cursor of the reader to the `member_name` of the object at the current position.

You can use `json_reader_get_value()` and its wrapper functions to retrieve the value of the member; for instance:

    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.:

    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 `json_reader_end_member()` is called. This means that if used conditionally, `json_reader_end_member()` must be called on all branches:

    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;
      }

Available since: 0.12

#### Parameters

`member_name`

  Type: `const gchar*`

  The name of the member to read.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

#### Return value

Type: `gboolean`

`TRUE` on success, and `FALSE` otherwise.