Skip to content

Instantly share code, notes, and snippets.

@walm
Created February 14, 2011 09:04
Show Gist options
  • Save walm/825639 to your computer and use it in GitHub Desktop.
Save walm/825639 to your computer and use it in GitHub Desktop.
C# to json
Dictionary<string, string> jsonObj = new Dictionary<string, string>();
jsonObj.Add("id", "32");
jsonObj.Add("end_date", "2011-01-01");
jsonObj.Add("title", "A titel");
jsonObj.Add("message", "A message");
string json = new JavaScriptSerializer().Serialize(json);
@walm
Copy link
Author

walm commented Feb 14, 2011

This will output as

{ "id":"32", "end_date":"2011-01-01", "title":"A title", "message":"A message" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment