(代码31),当使用jackson从URL解析json时,只允许使用空格

时间:2017-03-07 21:15:05

标签: java json jackson

当我尝试使用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"
            }
        ]
    }
}

0 个答案:

没有答案