Created
August 8, 2016 18:25
-
-
Save relwell/31430523b696a7541097eb699ec6d192 to your computer and use it in GitHub Desktop.
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
2.1.5 :023 > a | |
=> {:test=>"one two three", :foo=>456262, :nested=>{:is=>"pretty hard with csvs, and regular expressions"}} | |
2.1.5 :024 > a.to_json | |
=> "{\"test\":\"one two three\",\"foo\":456262,\"nested\":{\"is\":\"pretty hard with csvs, and regular expressions\"}}" | |
2.1.5 :025 > b = Base64.encode64(a.to_json) | |
Base64.encode64 | |
2.1.5 :025 > b = Base64.encode64(a.to_json) | |
=> "eyJ0ZXN0Ijoib25lIHR3byB0aHJlZSIsImZvbyI6NDU2MjYyLCJuZXN0ZWQi\nOnsiaXMiOiJwcmV0dHkgaGFyZCB3aXRoIGNzdnMsIGFuZCByZWd1bGFyIGV4\ncHJlc3Npb25zIn19\n" | |
2.1.5 :026 > Base64.decode64(b) | |
=> "{\"test\":\"one two three\",\"foo\":456262,\"nested\":{\"is\":\"pretty hard with csvs, and regular expressions\"}}" | |
2.1.5 :027 > JSON.parse(Base64.decode64(Base64.encode64(a.to_json))) | |
=> {"test"=>"one two three", "foo"=>456262, "nested"=>{"is"=>"pretty hard with csvs, and regular expressions"}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment