In android I create JSON String like this
jsonObject.toString();
But the problem is that Unicode chars aren't encoded, for example:
{"number":123456,"name":"בית"}
Should be:
{"number":123456,"name":"\u05D1\u05D9\u05EA"}
How do I do that? I tried different JSON converting libs but couldn't one that does it. One solution that I found is to escape it using StringEscapeUtils, and remove double slash in the string, like this:
jsonArray.put("name", StringEscapeUtils.escapeJson(name));
jsonArray.toString().replace("\\\\u", "\\u");
But I don't think this is the best solution for this case..