Skip to content

Add array iterator #20

@Kiyoshika

Description

@Kiyoshika

After finishing (#8), want to add a way to iterate over the array "natively". Something like

void callback(void* item)
{
    printf("%d ", *(int32_t*)item);
}

// somewhere in main() ...

char* json_string = "{ \"myarray\": [1, 2, 3] }";

struct json_t* json = json_parse_from_string(json_string);

json_foreach(json, "myarray", &callback);

// this should print 1 2 3

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions