Skip to content

Instantly share code, notes, and snippets.

@atomgiant
Created November 20, 2015 21:53
Show Gist options
  • Save atomgiant/4d7ed71308c2ef20f00f to your computer and use it in GitHub Desktop.
Save atomgiant/4d7ed71308c2ef20f00f to your computer and use it in GitHub Desktop.
# For a given Metafield, this is how
# you access the serialized JSON data
mf = {"id"=>10030144453,
"namespace"=>"product",
"key"=>"custom_attrs",
"value"=>"{\"width\":11.2,\"height\":35.7}",
"value_type"=>"string",
"description"=>nil,
"owner_id"=>1234567890,
"created_at"=>"2015-11-20T16:48:03-05:00",
"updated_at"=>"2015-11-20T16:48:03-05:00",
"owner_resource"=>"product"}
attrs = JSON.parse(mf["value"])
=> {"width"=>11.2, "height"=>35.7}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment