Skip to content

Instantly share code, notes, and snippets.

@ncdc
Last active December 24, 2015 07:40
Show Gist options
  • Save ncdc/6765613 to your computer and use it in GitHub Desktop.
Save ncdc/6765613 to your computer and use it in GitHub Desktop.
require 'json'
require 'active_support/hash_with_indifferent_access'
require 'active_support/core_ext/hash'
restart_output = {from_json: true, status: :success}
restart_output_json = JSON.dump(restart_output)
puts restart_output_json
# prints {"from_json":true,"status":"success"}
input = HashWithIndifferentAccess.new(JSON.load(restart_output_json))
puts input[:status]
# prints 'success'
puts input[:status].class
# prints String
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment