Don’t build the JSON manually. Instead, build an object graph, and then JSON-encode it:
@{
var data = Model.urunler.Where(u => u.Id = item.uid).Select(u => new
{
id = item.id,
urunadi = urun.urunadi
});
}
@Html.Raw(Json.Encode(data))
More Related Contents:
- MVC which submit button has been pressed
- Visual Studio 2015 not syntax highlighting razor nor Intellisense
- Proper JSON serialization in MVC 4
- ASP.NET MVC Razor render without encoding
- How to get current page URL in MVC 3
- How to use multiple form elements in ASP.NET MVC
- How do you create a dropdownlist from an enum in ASP.NET MVC?
- Parse JSON in C#
- How to return a file (FileContentResult) in ASP.NET WebAPI
- How do I create a Dto in C# Asp.Net from a fairly complex Json Response
- How to pass IEnumerable list to controller in MVC including checkbox state?
- Questions about using Ninject
- @Html.DropDownListFor how to set default value [duplicate]
- DisplayNameFor() From List in Model
- ASP.NET MVC DropDownListFor with model of type List
- How to get JSON response from a 3.5 asmx web service
- Is it secure to store passwords in cookies?
- Visual Studio – Resx File default ‘internal’ to ‘public’
- ASP.NET MVC – How to show unauthorized error on login page?
- I’m getting the “missing a using directive or assembly reference” and no clue what’s going wrong
- MvcSiteMap generating a Menu without messing the breadcumbs
- How can I trigger/refresh my main .RAZOR page from all of its sub-components within that main .RAZOR page when an API call is complete?
- Possible to access MVC ViewBag object from Javascript file?
- The model item passed into the dictionary is of type ‘mvc.Models.ModelA’ but this dictionary requires a model item of type ‘mvc.Models.ModelB‘
- Get UserID of logged-in user in Asp.Net MVC 5
- Can I use ASP.NET MVC together with regular ASP.NET Web forms
- pass jquery json into asp.net httphandler
- System.web.mvc missing
- How to route EVERYTHING other than Web API to /index.html
- JSON Deserialization – String Is Automatically Converted To Int