From: Brian Candler Date: 2010-07-12T06:00:38+09:00 Subject: Re: How to pass a hash as a param to a method called through eval? Just use 'puts' instead of 'eval' to see what's happening. >> json = < "{\n \"action\": \"someFunc\",\n \"params\": {\n \"a\": \"foo\",\n \"b\": \"bar\",\n \"c\": \"etc\"\n }\n}\n" >> require 'rubygems' => true >> require 'json' => true >> call = JSON.parse(json) => {"action"=>"someFunc", "params"=>{"a"=>"foo", "b"=>"bar", "c"=>"etc"}} >> puts "#{call['action']} #{call['params']}" someFunc afoobbarcetc => nil >> puts "#{call['action']}('#{call['params']}')" someFunc('afoobbarcetc') => nil >> Should be pretty obvious now, remember that eval is just interpreting that string as a piece of ruby code. -- Posted via http://www.ruby-forum.com/.