title: Evaluate stringified json having interpolatable value
body: <p>Suppose variable <code>b=2</code> and a stringified json </p>
  
  <pre><code>j = '{"b": "#{b}", "c": null}'
  </code></pre>
  
  <p>The desired result is:</p>
  
  <pre><code>{
    "b" =&gt; "2",
    "c" =&gt; nil
  }
  </code></pre>
  
  <p>My observation:</p>
  
  <p>Since json string contains null, we <strong>can not eval</strong> it because ruby will say <strong>undefined variable or method</strong> <code>null</code>. Also, I don't want to replace <code>null</code> with <code>nil</code>.</p>
  
  <p>The only option left is to parse and evaluate. 
  So I tried the following:</p>
  
  <pre><code>eval(JSON.parse(j).to_s) 
  </code></pre>
  
  <p>which results to </p>
  
  <pre><code>{
      "b" =&gt; "\#{b}"
  }
  </code></pre>
  
  <p>Please help to achieve desired result?</p>