From 6cf8e399fe5a71d121b3729698d417f770965632 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 9 Aug 2016 18:35:21 -0400 Subject: [PATCH] properly put escapes on strings --- core/src/processing/data/IntDict.java | 2 +- core/todo.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/processing/data/IntDict.java b/core/src/processing/data/IntDict.java index dd6337b7e..965fedb4d 100644 --- a/core/src/processing/data/IntDict.java +++ b/core/src/processing/data/IntDict.java @@ -666,7 +666,7 @@ public class IntDict { public String toJSON() { StringList items = new StringList(); for (int i = 0; i < size(); i++) { - items.append("\"" + keys[i] + "\": " + values[i]); + items.append("\"" + JSONObject.quote(keys[i]) + "\": " + values[i]); } return "{ " + items.join(", ") + " }"; } diff --git a/core/todo.txt b/core/todo.txt index 4be30e948..afdd11b3d 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -3,6 +3,7 @@ X some Table cleanup based on other CSV parsing work X use StandardCharsets.UTF_8 instead of getting encoding by name X PApplet.main(Blah.class) now works X add toJSON() method to IntDict +X had to use JSONObject.quote() to wrap the text _ do the same for the other data classes _ note the difference between this and toJSONObject() or toJSONArray() _ or is that the better way to handle it? hm