Created
May 2, 2016 12:26
-
-
Save YumaInaura/6f84f246a373f0e913a26715820878d2 to your computer and use it in GitHub Desktop.
Rails | ハッシュのキーを全てシンボルから文字列に変える ( stringify_keys / deep_stringify_keys ) ref: http://qiita.com/Yinaura/items/4d999e0ee6b450f25ae7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ a: 1, b: 2, c: 3 }.stringify_keys | |
# => {"a"=>1, "b"=>2, "c"=>3} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ a: 1, b: 2, c: { d: 3 } }.deep_stringify_keys | |
# => {"a"=>1, "b"=>2, "c"=>{"d"=>3}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ a:1, b: 2, c: [ { d: [ { e:3 } ] } ] }.deep_stringify_keys | |
# => {"a"=>1, "b"=>2, "c"=>[{"d"=>[{"e"=>3}]}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment