Nil Pun
Nil Pun

Reputation: 17383

Knockout - How to set Observable Property to JSON REsult from asp.net MVC

The MVC application returns a JSON REsult which contains a JSON object. For knockout 2 way binding to work it requires ko.observable("value").

Is there a way we can set two way binding to the JSON Object returned from MVC?

Upvotes: 1

Views: 803

Answers (1)

RP Niemeyer
RP Niemeyer

Reputation: 114792

While you can manually loop through your structure and create appropriate observables, you will probably want to look at the mapping plugin described here: http://knockoutjs.com/documentation/plugins-mapping.html

Upvotes: 1

Related Questions