Could you please help me find what I am doing wrong?
My model has a string[] field called AllKnownColors. I am trying to use it in my javascript code like this:
var clrs = JSON.parse('@Html.Raw(Model.AllKnownColors)');
But it doesn't work. The debugger shows me this:
var clrs = JSON.parse('System.String[]');
and the following error: Uncaught SyntaxError: Unexpected token S
And I cannot figure out what is wrong.
Thanks.
@Html.Raw(Model.AllKnownColors)to result in? As you can see, it turns into"System.String[]"when turned into a string (usingToString()internally asHtml.Raw()does).