aro*_*sca 5 scala jackson json4s
我在尝试使用 json4s 解析 JSON 时收到以下错误:
Non-standard token 'NaN': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow
Run Code Online (Sandbox Code Playgroud)
如何启用此功能?
假设您的ObjectMapper对象名为mapper:
val mapper = new ObjectMapper()
// Configure NaN here
mapper.configure(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS, true)
...
val json = ... //Get your json
val imported = mapper.readValue(json, classOf[Thing]) // Thing being whatever class you're importing to.
Run Code Online (Sandbox Code Playgroud)