Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. Dictionary<string, object> items = new Dictionary<string, object>();
  2. items.Add("a number", 1.23f);
  3. items.Add("a point", new Point(5,6));
  4.  
  5. JsonSerializerSettings settings = new JsonSerializerSettings() { Formatting = Formatting.Indented, TypeNameHandling=TypeNameHandling.All };
  6. var serialized = JsonConvert.SerializeObject(items, settings);
  7.  
  8. {
  9. "$type": "System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.Object, mscorlib]], mscorlib",
  10. "a number": 1.23,
  11. "a point": "5,6"
  12. }
  13.  
  14. {
  15. { "a number": 1.23, "$type" : "System.Float, mscorlib..." },
  16. { "a point": "5,6", "$type" : "System.Drawing.Point..." }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement