Ruby to_json 的\u 的问题

colorfulberry · 2015年01月09日 · 最后由 colorfulberry 回复于 2015年01月11日 · 1750 次阅读
{sa: [{id: :&}]}.to_json
=> "{\"sa\":[{\"id\":\"\\u0026\"}]}"

现在不想他吧& 转换成\u0026

期望结果

{"sa":[{"id":"&"}]}

请问怎么办?

@rei

需要 登录 后方可回复, 如果你还没有账号请 注册新账号