我有一个ruby json对象。例如
在控制器中
@my_hash = {"5":{"id":5,"name":"ANKLOS","code":"724.9","description":"Ankylosis of spine (Spine Fusion)","title":"ANKLOS - 724.9 - Ankylosis of spine (Spine Fusion)"},"3":{"id":3,"name":"Loren Lipsum","code":"Test","description":"Test t2 stest","title":"Loren Lipsum - Test - Test t2 stest"}}
我在视野中使用了 @my_hash 。我的内容来自表格。
<script type="text/javascript">
var my_hash = <%= @my_hash.to_json %>;
</script>
但是my_hash的结果就像
var diagnosisCodes = {"":{"code":"\u0026larr;","description":""},"5":{"id":5,"name":"ANKLOS","code":"724.9","description":"Ankylosis of spine (Spine Fusion)","title":"ANKLOS - 724.9 - Ankylosis of spine (Spine Fusion)"},"3":{"id":3,"name":"Loren Lipsum","code":"Test","description":"Test t2 stest","title":"Loren Lipsum - Test - Test t2 stest"}};
我需要像@my_hash一样的输出。我怎么能这样做?