Skip to content

Iterating over map or array returned with MMDB_get_value() #255

@gonzus

Description

@gonzus

I am working with the example data from the library's documentation:

{
    "names": {
        "en": "Germany",
        "de": "Deutschland"
    },
    "cities": [ "Berlin", "Frankfurt" ]
}

Say I call

MMDB_get_value(&result.entry, &entry_data, "names", NULL);

This will produce entry_data.type == 7, which is a MAP, as expected. How can I then retrieve the values for specific keys in this map? Because entry_data is a MMDB_entry_data_s and NOT a MMDB_entry_s, I cannot pass it into MMDB_get_value.

Same question would apply for an array:

MMDB_get_value(&result.entry, &entry_data, "cities", NULL);

This will produce with entry_data.type == 11, which is an ARRAY, as expected. How can I then retrieve the values for specific positions in this array?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions