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
  • 54,162
  • 23
  • 101
  • 92
user437899
  • 8,879
  • 13
  • 51
  • 71

1 Answers1

55

I think I found the solution:

[JsonProperty(PropertyName = "Myname")]

will rename it.

Paolo Moretti
  • 54,162
  • 23
  • 101
  • 92
user437899
  • 8,879
  • 13
  • 51
  • 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