c# asp.net delete last comma [closed]

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))

Leave a Comment