Ruby hash access value from string array <p>I have an hash like below:</p> <pre><code>hash = {"a": [{"c": "d", "e": "f"}] } </code></pre> <p>Normally we can access it like <code>hash["a"][0]["c"]</code>.</p> <p>But, I have a string like:</p> <pre><code>string = "a[0]['c']" </code></pre> <p>(This can change depending upon user input)</p> <p>Is there any easy way to access hash using above string values?</p>