Parsing Hashie::Mash output to Json in ruby Parsing Hashie::Mash output to Json in ruby json json

Parsing Hashie::Mash output to Json in ruby


I was able to do it using to_json


I also got this same object as params with Grape.

Hashie::Mashparams: #<Hashie::Mash data=#<Hashie::Mash attributes=#<Hashie::Mash title="Ember Hamster"> type="pictures">>

If you are using Rails We can convert into ruby hash as following:

params.to_hash

gives

{"data"=>{"type"=>"pictures", "attributes"=>{"title"=>"Ember Hamster"}}}