diff --git a/src/com/sap/piper/analytics/InfluxData.groovy b/src/com/sap/piper/analytics/InfluxData.groovy index b9b103327..53467519b 100644 --- a/src/com/sap/piper/analytics/InfluxData.groovy +++ b/src/com/sap/piper/analytics/InfluxData.groovy @@ -58,8 +58,19 @@ class InfluxData implements Serializable{ def value if (name.endsWith(".json")){ name = name.replace(".json","") - script.echo "found JSON content: " + fileContent - value = script.readJSON(text: fileContent) + // net.sf.json.JSONSerializer does only handle lists and maps + // http://json-lib.sourceforge.net/apidocs/net/sf/json/package-summary.html + try{ + value = script.readJSON(text: fileContent) + }catch(net.sf.json.JSONException e){ + // try to wrap the value in an object and read again + if (e.getMessage() == "Invalid JSON String"){ + def JSONobject = readJSON(text: "{\"content\": ${fileContent}}") + value = JSONobject.content + }else{ + throw e + } + } }else{ // handle boolean values if(fileContent == 'true'){