How to access to given element in Json
<p>I am new to Json. please tell me how to access following element. this is my Json </p>

<pre><code>var data = {"student":[{"fname":"mad", "sname":"cha"}, {"fname":"sun", "sname":"ban"}, {"fname":"sha", "sname":"kiri"}]};
</code></pre>

<p>so how I access to the <code>"mad"</code>value.</p>

<p>actually this is what I trying to do</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;

&lt;script&gt;
    function click_me(){
        var data = {"student":[{"fname":"mad", "sname":"cha"}, {"fname":"sun", "sname":"ban"}, {"fname":"sha", "sname":"kiri"}]};
        localStorage.setItem('my_name',data);
        alert('OK');
    }

    function show_me(){
        var x = localStorage.getItem('my_name');
        x = x.student[0].fname;
        alert(x);
    }
&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;
  &lt;input type="button" name="btn" value="Click" onclick="click_me()"&gt;
  &lt;input type="button" name="btn" value="show_me" onclick="show_me()"&gt;
&lt;/body&gt;
&lt;/html&gt; 
</code></pre>
