1

I'm passing a List<Results> object to my view as the model. On that page I'm trying to convert it to Javascript to use client side.

var model = '@Html.Raw(Json.Encode(Model))';
var data = JSON.parse(model);
self.Results = ko.observableArray(data);

When I do I get this error jQuery.Deferred exception: JSON.parse: bad escaped character at line 1 column 240 of the JSON data

I know I need to escape the data but not sure at what point or how.

user3953989
  • 1,844
  • 3
  • 25
  • 56

0 Answers0