Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to create key value pair json data from a list in c#
i need this type of output
"[[{\"name\": \"name\",\"value\": \"Another new product\"},{\"name\": \"description\",\"value\": \"A description of yet another product.\"},{\"name\": \"price\",\"value\": \"250.00\"}]]


What I have tried:

find in google for solution but nothing found
Posted
Updated 4-Dec-18 1:24am

1 solution

Take a look: Serializing a list to JSON

C#
// you need to reference System.Web.Extensions

using System.Web.Script.Serialization;

var jsonSerialiser = new JavaScriptSerializer();
var json = jsonSerialiser.Serialize(aList);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900