fastjson
fastjson copied to clipboard
JSON.parseObject can not process strings with escaped characters
println new Gson().fromJson('{"args": "{\\"key\\":\\"value\\"}","context": "ctx"}', Map.class)
// result: [args:{"key":"value"}, context:ctx]
println new ObjectMapper().readValue('{"args": "{\\"key\\":\\"value\\"}","context": "ctx"}', Map.class)
// result: [args:{"key":"value"}, context:ctx]
println JSON.parseObject('{"args": "{"args": "{\\"key\\":\\"value\\"}","context": "ctx"}', Map.class) // version 1.2.42
// can not parse Exception com.alibaba.fastjson.JSONException: syntax error, position at 0, name args
@kimmking @wenshao The same parameters, only exception occurred when fastjson parse, which is a bug?