【发布时间】:2020-12-15 23:57:07
【问题描述】:
val jsonObject = new org.json.JSONObject("{\"name\":\"abc\",\"Estd date\":\"23.06.1995\",\"GrowthRate\":50%}")
println(jsonObject)
new ObjectMapper().readTree("{\"name\":\"abc\",\"Estd date\":\"23.06.1995\",\"GrowthRate\":50%}")
Exception in thread "main" com.fasterxml.jackson.core.JsonParseException: Unexpected character ('%' (code 37)): was expecting comma to separate OBJECT entries
怎样才能拥有与 JSONObject 相同的行为?我们有一些限制,因此我们不能使用 JSONObject。有什么帮助吗?
有没有办法使用自定义序列化程序来做到这一点?像 $50 这样的货币符号也应该被解析。
我正在使用 jackson-databind-2.6.7.1.jar
【问题讨论】:
标签: json scala jackson serialization