Witam Próbuję wysłać ciąg do widoku, który wygląda jak json.C# do json nie renderowanie poprawnie w widoku
Im wysyłając listę miejsc:
class Place
{
public string title { get; set; }
public string description { get; set; }
public double latitude { get; set; }
public double longitude { get; set; }
}
List<Place> placeList = new List<Place>();
//add places to PlaceList
//Then i do this
System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
string sJSON = oSerializer.Serialize(placeList);
ViewBag.Places = sJSON;
W widoku jego wyjście renderingu tak jakby:
[{"title":"sdf sdfsd sdf sd f","description":"sdf sdf sd fsd sd sdf sdf dssd sdf sd s","latitude":53.740259851464685,"longitude":-2.4602634343627927},
Jak mogę zmusić go do renderowania jako normalne json w widoku? minus "
itp?
też myślę, że to dziwne, że oSerializer.Serialize powrót html zakodowany ciąg. Czy jesteś pewien, że renderowanie w twoim widoku nie ma żadnego wstępnego przygotowania? –
Próbowałem: HttpUtility.HtmlDecode (oSerializer.Serialize (placeList)); - ten sam wynik: – raklos
w moim widoku mam: "places": @ ViewBag.Places – raklos