32

I use the JsonSerializer from Newtonsoft.

But i want to name the json-objects by myself.

I tried the JsonObject attribute

[JsonObject(Description = "MyName", Title = "orThisname")]

JsonArray also didnt work... Is it possible to name the json-objetcs/arrays by myself?

Paolo Moretti
  • 51,429
  • 22
  • 99
  • 91
user437899
  • 8,549
  • 12
  • 47
  • 71

1 Answers1

55

I think I found the solution:

[JsonProperty(PropertyName = "Myname")]

will rename it.

Paolo Moretti
  • 51,429
  • 22
  • 99
  • 91
user437899
  • 8,549
  • 12
  • 47
  • 71
  • 9
    Why did this get accepted? This does not give the object itself a name, that is what is being asked. This renames a property marked for serialization. – Madmenyo Mar 17 '14 at 20:59