From 75f9d7e66ef9a39298cfeceb6160e069cc5b5f56 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Wed, 26 Mar 2014 15:06:24 +0100 Subject: [PATCH] add nChildren to json properties --- src/Network/http/jsonprops.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Network/http/jsonprops.cxx b/src/Network/http/jsonprops.cxx index 3b159d2fe..5e7a4b54d 100644 --- a/src/Network/http/jsonprops.cxx +++ b/src/Network/http/jsonprops.cxx @@ -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())); - cJSON_AddItemToObject(json, "value", cJSON_CreateString(n->getStringValue())); + 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(); -- 2.39.5