How to convert json to struct in an elegant way in c

there is a json and a struct:

json:

{
    "zone":12
    "id":1
    "rule":8
    "name":"jsontest"
}

struct:

strict foo
{
    int Zone;
    int Id;
    uint8_t Rule;
    char Name[32];
}

I create a map to convert json to struct:

map[]
{
    /* label   key   func*/
    {Zone, "zone", JsonSafeGetInt},
    {Rule, "rule", JsonSafeGetInt},
    {Id, "id", JsonSafeGetInt},
    {Name, "name", JsonSafeGetString}
}

I want to use the map to convert json to struct:

strict foo *fooPtr;
for (i = 0; i< MapSize; i++)
{
    fooPtr->map[i].label = map[i].func(xxx);
}

But I don't know if it can be implemented, because I don't know how to write such code in C.