Server-side processing: Invalid JSON primitive

Server-side processing: Invalid JSON primitive

SerberussSerberuss Posts: 2Questions: 2Answers: 0

I am trying to send data to an MVC action using server-side processing but I get the error "Invalid JSON primitive" from my browser. I've checked the JSON that I'm passing and it looks to be correct so I'm wondering whether I need a setting for the datatable? This is what I have so far:


var dataRows = [{ "RowCells": ["Test", "Test"] }];                                                
dataTableOptions = {
    processing: true,
    serverSide: true,
    ajax:  {
        url: "/Data/ProcessDataTable",
        type: "POST",
        contentType: "application/json",
        data: JSON.stringify({ dataRows: dataRows })


public JsonResult ProcessDataTable(IEnumerable<ReportRow> dataRows)

ReportRow class

public class ReportRow
    public IList<string> RowCells { get; set; }

I have passed the JSON to and I get the message

Parse error on line 1:
Expecting '{', '['

I'd appreciate any help with this issue


  • allanallan Posts: 62,056Questions: 1Answers: 10,173 Site admin

    It looks like you need to have the server respond with JSON. For exactly how you do that you would need to ask in a .NET forum as I'm afraid I can't help there.


This discussion has been closed.