Skip to content

Instantly share code, notes, and snippets.

@danielribeiro
Created September 7, 2016 22:19
Show Gist options
  • Save danielribeiro/20be47ba2d7cfca6f76a8c64739106c1 to your computer and use it in GitHub Desktop.
Save danielribeiro/20be47ba2d7cfca6f76a8c64739106c1 to your computer and use it in GitHub Desktop.
require 'json'
require 'ostruct'
require 'pp'
str = { woo: [ 1, 2, 3], yay: { foo: true, bar: ["42", 2, {}] } }.to_json
pp JSON.parse(str, object_class: OpenStruct).yay.bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment