Browse Source

fix line breaks were not parsed correctly in json

Kolja Strohm 8 months ago
parent
commit
b4bfe2de89
1 changed files with 2 additions and 0 deletions
  1. 2 0
      JSON.cpp

+ 2 - 0
JSON.cpp

@@ -123,6 +123,7 @@ JSONString::JSONString(Text string)
 {
     this->string = string;
     string.ersetzen("\\\"", "\"");
+    string.ersetzen("\\n", "\n");
 }
 
 Text JSONString::getString() const
@@ -134,6 +135,7 @@ Text JSONString::toString() const
 {
     Text esc = string;
     esc.ersetzen("\"", "\\\"");
+    esc.ersetzen("\n", "\\n");
     return Text(Text("\"") += esc.getText()) += "\"";
 }