我正在尝试处理 JSON,并且在双值之前发现了 /u200b (零宽度空间)。我现在无法解析它,甚至将字段类型设置为 String。在这里我可以轻松删除它,但是如何处理从服务器下载内容呢?
String testJson = "{" +
" \"name\": \"Aarhus\"," +
" \"latitude\": \u200B56.3," +
" \"longitude\": \u200B10.619,"
" }";
最佳答案
如果您的数据已包含在字符串中,请使用以下替换。
testJson =testJson.replaceAll("\u200B", "");
如果您需要先从 url 加载数据,那么这里讨论一些巧妙的方法:Read url to string in few lines of java code
关于java - Json 中的零宽度空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37194215/