How do I create a javascript object like this?
<p>Hi guys I'm trying to create a javascript object like this:</p>

<pre><code>data = { values:[
        { X: "Apples", Y: 120 },
        { X: "Oranges", Y: 280 },
        { X: "Chocolates", Y: 180 },
        { X: "Bananas", Y: 340 },
        { X: "Tomatoes", Y: 400 },
]};
</code></pre>

<p>I've tried this but it doesn't work?</p>

<pre><code>var data = {};

for (i = 0; i &lt; json.Answers.length; i++){
    data.values[i].X = json.Answers[i].AnswerText
    data.values[i].Y = json.Answers[i].Responses.length
    }
</code></pre>

<p>The json part is fine, any ideas on constructiong the object?</p>
