This project has moved and is read-only. For the latest updates, please go here.

Multiple Items

Dec 27, 2008 at 7:14 PM

Hello all,

I am trying to create JSON valu for the structure below via Json.NET.

  itemCount: 2,
  subtotal: '$15.50',
      title: 'The Big Book of Foo',
      description: 'Bestselling book of Foo by A.N. Other',
      imageUrl: '/images/books/12345.gif',
      price: '$10.00',
      qty: 1
      title: 'Javascript Pocket Reference',
      description: 'Handy pocket-sized reference for the Javascript language',
      imageUrl: '/images/books/56789.gif',
      price: '$5.50',
      qty: 1

I prepared the code as shown below to handle that but i could not add second item to the Json , how can i do that ,please help me  :)

        StringBuilder sb = new StringBuilder();
        StringWriter sw = new StringWriter(sb);

        using (JsonWriter jsonWriter = new JsonTextWriter(sw))

               jsonWriter.Formatting = Formatting.Indented;




                jsonWriter.WriteValue("The Big Book of Foo");
                jsonWriter.WriteValue("Bestselling book of Foo by A.N. Other");


Dec 28, 2008 at 8:10 AM