Click or drag to resize
Json.NET

Serialize a Collection

 

This sample serializes a collection to JSON.

Sample
Usage
List<string> videogames = new List<string>
{
    "Starcraft",
    "Halo",
    "Legend of Zelda"
};

string json = JsonConvert.SerializeObject(videogames);

Console.WriteLine(json);
// ["Starcraft","Halo","Legend of Zelda"]