Ruby to_json 的\u 的问题

colorfulberry · January 09, 2015 · Last by colorfulberry replied at January 11, 2015 · 1750 hits
{sa: [{id: :&}]}.to_json
=> "{\"sa\":[{\"id\":\"\\u0026\"}]}"

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

期望结果

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

请问怎么办?

@rei

You need to Sign in before reply, if you don't have an account, please Sign up first.