鉴于Json是这样的:
{
"description": "foo \n bar"
}
如果我尝试使用Hash(String, String)
方法创建from_json
,我会收到以下错误:
Unexpected char '
' at 1:22 (JSON::ParseException)
如何正确解析它?
require "json"
Hash(String, String).from_json(%({"description": "foo \n bar"}))