Below is my method which makes the JSONObject and then print out the JSONString.
JSONObject
JSONString
I am using Google GSON.
private String gen
Use StringEscapeUtils:
import org.apache.commons.lang3.StringEscapeUtils; (...) myString = StringEscapeUtils.escapeJson(myString);
On Android, remember to update your app/build.gradle:
compile 'org.apache.commons:commons-lang3:3.4'