Skip to content
Snippets Groups Projects
Commit b78beaf5 authored by René Schöne's avatar René Schöne
Browse files

apply suggested fix for #3

parent 74654ffb
Branches main
No related tags found
No related merge requests found
...@@ -56,8 +56,14 @@ aspect Helpers { ...@@ -56,8 +56,14 @@ aspect Helpers {
// --- helper methods for put/add --- // --- helper methods for put/add ---
protected SimpleElement ComplexElement.makeStringElement(String value) { 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 // simple test, check for special characters
return containsAny(value, "[{\"\n") ? return containsAny(value, ":#,[{\"\n") ?
StringElement.of(value.replace("\n", "\\n").replace("\"", "\\\"")) : StringElement.of(value.replace("\n", "\\n").replace("\"", "\\\"")) :
ValueElement.of(value); ValueElement.of(value);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment