0

Is there any way to change the FieldName Value for a property in a Viewmodel? I would like to use the standard naming convention for the property, but have the viewmodel return something else. This is important, because I have a json request that requires the properties to be in lowercase.

I have tried using both XMLAttributes, and DataMembers, but neither of those soultions worked. Those came from the following questions.

Serialize .Net object to json, controlled using xml attributes

JavaScriptSerializer.Deserialize - how to change field names

So, to reiterate, I need something like this

 public string Start { get; set; } 

to show up as

 viewmodel.start

instead of

viewmodel.Start

when I am passing my viewmodel to the callback inside the getJson request

Community
  • 1
  • 1
Aaron M
  • 2,523
  • 1
  • 23
  • 38

1 Answers1

-1

What about adding an extra property to your model?

public string start {get {return Start;}}
ghallas
  • 285
  • 2
  • 14