diff --git a/Helpers.jrag b/Helpers.jrag index 41287726d4e900a0ef096abee83f679daf74808c..c8bbc58b473522e3eda5009660b9613a6d54ad5c 100644 --- a/Helpers.jrag +++ b/Helpers.jrag @@ -56,8 +56,14 @@ aspect Helpers { // --- helper methods for put/add --- protected SimpleElement ComplexElement.makeStringElement(String value) { + if (value == null || value.equals("null")) { + return StringElement.of("null"); + } + if (value.isBlank()) { + return StringElement.of(value); + } // simple test, check for special characters - return containsAny(value, "[{\"\n") ? + return containsAny(value, ":#,[{\"\n") ? StringElement.of(value.replace("\n", "\\n").replace("\"", "\\\"")) : ValueElement.of(value); }