i have issue with this function : JSONVar keys() const;
cpp part is :
B4X:
JSONVar JSONVar::keys() const
{
if (!cJSON_IsObject(_json)) {
return JSONVar(NULL, NULL);
}
int length = cJSON_GetArraySize(_json);
const char* keys[length];
cJSON* child = _json->child;
for (int i = 0; i < length; i++, child = child->next) {
keys[i] = child->string;
}
return JSONVar(cJSON_CreateStringArray(keys, length), NULL);
}
Wrapper should create an ArrayObject with all keys provided by the function
Wrapper in creation but stuck :
B4X:
ArrayObject* B4RJSONVar::keys()
{
JSONVar jtmp = jsonV.keys(); // create un JSONVar Array with all keys used.(each key is a string)
int len = jtmp.length(); // read length of array, = nb of Stings
for (int i = 0;i<len;i++) { // and read of each string
....................wrapPointer(jtmp[i]); //=> to be added at an ArrayObject
}
Array* arr = ...............................................
arr->length = .............................................
arr->data = .......................................
return arr;