add nChildren to json properties
This commit is contained in:
parent
0dcc8aa34d
commit
75f9d7e66e
1 changed files with 3 additions and 2 deletions
|
@ -74,12 +74,13 @@ cJSON * JSON::toJson(SGPropertyNode_ptr n, int depth, double timestamp )
|
|||
cJSON * json = cJSON_CreateObject();
|
||||
cJSON_AddItemToObject(json, "path", cJSON_CreateString(n->getPath(true).c_str()));
|
||||
cJSON_AddItemToObject(json, "name", cJSON_CreateString(n->getName()));
|
||||
if( n->hasValue() )
|
||||
cJSON_AddItemToObject(json, "value", cJSON_CreateString(n->getStringValue()));
|
||||
cJSON_AddItemToObject(json, "type", cJSON_CreateString(getPropertyTypeString(n->getType())));
|
||||
cJSON_AddItemToObject(json, "index", cJSON_CreateNumber(n->getIndex()));
|
||||
if( timestamp >= 0.0 )
|
||||
cJSON_AddItemToObject(json, "ts", cJSON_CreateNumber(timestamp));
|
||||
|
||||
cJSON_AddItemToObject(json, "nChildren", cJSON_CreateNumber(n->nChildren()));
|
||||
|
||||
if (depth > 0 && n->nChildren() > 0) {
|
||||
cJSON * jsonArray = cJSON_CreateArray();
|
||||
|
|
Loading…
Reference in a new issue