string json = JsonConvert.SerializeObject(table, Formatting.Indented);
Edit: You don’t need indented formatting, of course, but it makes it nice and readable.
More Related Contents:
- Convert DataTable to JSON with key per row
- How can I parse a JSON string that would cause illegal C# identifiers?
- How to implement custom JsonConverter in JSON.NET?
- Does Json.NET cache types’ serialization information?
- How to convert JSON to XML or XML to JSON?
- Deserialize json with known and unknown fields
- Using JsonConvert.DeserializeObject to deserialize Json to a C# POCO class
- How to write a JSON file in C#?
- Parse Json string in C#
- Deserializing JSON to abstract class
- Not ableTo Serialize Dictionary with Complex key using Json.net
- How to tell Json.Net globally to apply the StringEnumConverter to all enums
- Iterating over JSON object in C#
- Json.NET custom serialization with JsonConverter – how to get the “default” behavior
- Send JSON via POST in C# and Receive the JSON returned?
- Deserializing heterogenous JSON array into covariant List using Json.NET
- DataTable to JSON [duplicate]
- Find and return JSON differences using newtonsoft in C#?
- Ignoring null fields in Json.net
- How can I tell Json.NET to ignore properties in a 3rd-party object?
- Deserialize specific enum into system.enum in Json.Net
- Json.net serialize numeric properties as string
- Using Custom WCF Body Deserialization without changing URI Template Deserialization
- Json.Net PopulateObject – update list elements based on ID
- Serialize/Deserialize dynamic property name using JSON.NET
- Deserializing JSON into an object with Json.NET
- Ignore Base Class Properties in Json.NET Serialization
- Null-coalescing operator returning null for properties of dynamic objects
- Is there a way in Json.NET serialization to distinguish between “null because not present” and “null because null”?
- Json.net serialization of custom collection implementing IEnumerable