Alternate JSON format possible?

Apr 15, 2011 at 6:17 PM
Edited Apr 15, 2011 at 6:17 PM

Given the following standard-looking JSON output:

 { "Name": "Apple", "Price": 3.99, "Sizes": ["Small", "Medium",  "Large"] }

.. may I instead generate the output as follows?  How?

 [ "Apple", 3.99, ["Small", "Medium", "Large"] ]

Apr 29, 2011 at 7:22 AM

Why do you want to "convert" an object into a collection?

Given this is C#
The first representation:

new {
Name = "Apple",
Price = 3.99,
Sizes = new string[]{ "Small", "Medium", "Large" }
}

The second one is:

new object[]{
"Apple",
3.99,
new string[]{ "Small", "Medium", "Large" }
}