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

1 Answer 1

-1

What about adding an extra property to your model?

public string start {get {return Start;}}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.