changeset 192:bb295c0feb3e

Fix JSON validity
author Chris Cannam
date Wed, 22 Jul 2015 14:34:26 +0100
parents 4ef452f5fefc
children f9723275ba4c
files runner/JAMSFeatureWriter.cpp
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/runner/JAMSFeatureWriter.cpp	Wed Jul 22 14:25:14 2015 +0100
+++ b/runner/JAMSFeatureWriter.cpp	Wed Jul 22 14:34:26 2015 +0100
@@ -147,14 +147,17 @@
             d += QString(", \"value\": [ ");
             for (int j = 0; j < int(f.values.size()); ++j) {
                 if (isnan(f.values[j])) {
-                    d += "\"NaN\" ";
+                    d += "\"NaN\"";
                 } else if (isinf(f.values[j])) {
-                    d += "\"Inf\" ";
+                    d += "\"Inf\"";
                 } else {
-                    d += QString("%1 ").arg(f.values[j]);
+                    d += QString("%1").arg(f.values[j]);
+                }
+                if (j + 1 < int(f.values.size())) {
+                    d += ", ";
                 }
             }
-            d += "]";
+            d += " ]";
         }
             
         d += " }";