Code

json requires keys to be proper strings and thus quoted ...
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 22 Feb 2012 22:11:18 +0000 (22:11 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 22 Feb 2012 22:11:18 +0000 (22:11 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@2276 a5681a0c-68f1-0310-ab6d-d61299d08faa

src/rrd_tool.c

index e481fa352bfb42bcd2218c272a4089543285087f..4dd4cae1f1c6524cbe6b56a8cf74e7a1681ed96b 100644 (file)
@@ -743,7 +743,7 @@ int HandleInputLine(
 
 #define pXJV(indent,fmt,tag,value) \
             if (json) { \
-               printf(indent "%s: " fmt ",\n",tag,value); \
+               printf(indent "\"%s\": " fmt ",\n",tag,value); \
             } else { \
                printf(indent "<%s>" fmt "</%s>\n",tag,value,tag); \
             }
@@ -757,7 +757,7 @@ int HandleInputLine(
             }
              
             if (json){
-                printf("    %s: [\n", LEGEND_TAG);
+                printf("    \"%s\": [\n", LEGEND_TAG);
             }
             else {
                 printf("    <%s>\n", LEGEND_TAG);
@@ -788,7 +788,7 @@ int HandleInputLine(
             }
             
             if (json){
-                printf("  %s: [\n",DATA_TAG);
+                printf("  \"%s\": [\n",DATA_TAG);
             } else {
                 printf("  <%s>\n", DATA_TAG);
             }