I am attempting to use the cJSON library, written by Dave Gamble, to read in the following JSON array:
\"items\":
[
{
\"name\": \"command\",
My guess (not having read the spec, and being a bit rusty with C):
request_json = cJSON_Parse(request_body);
items = cJSON_GetObjectItem(request_json, "items");
for (int i = 0; i < max; i++) { // Presumably "max" can be derived from "items" somehow
cJSON* item = cJSON_GetArrayItem(items, i);
name = cJSON_GetObjectItem(item, "name");
index = cJSON_GetObjectItem(item, "index");
optional = cJSON_GetObjectItem(item, "optional");
// Stash above info somewhere
}