当我尝试使用jackson映射下面的json响应时出现以下错误:
Illegal character ((CTRL-CHAR, code 31)):
only regular white space (\r, \n,\t) is allowed between tokens
我有什么方法可以在映射之前过滤掉任何格式错误的json吗?
node = new ObjectMapper().readTree(new URL(uri.toString())); <<<<< THROWS THE ERROR
{
meta: {
indexAllowed: false
},
products: {
products: [
{
id: 1,
name: "Apple iPhone 6 16GB 4G LTE GSM Factory Unlocked"
},
{
id: 2,
name: "Apple iPhone 7 8GB 4G LTE GSM Factory Unlocked"
}
]
}
}