Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7569409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:09:33+00:00 2026-05-30T15:09:33+00:00

I use datatables.net jQuery plugin to work with ajax tables. I want to send

  • 0

I use datatables.net jQuery plugin to work with ajax tables. I want to send a POST request with JSON data in it. I use JSON.stringify to turn my data into JSON. It produces the result like this:

[
  {"name":"sEcho","value":1},
  {"name":"iColumns","value":9},
  {"name":"sColumns","value":""},
  {"name":"iDisplayStart","value":0}
...]

Though I want it to be like this:

{"sEcho":1, "iColumns":9, "sColumns":"", "iDisplayStart":0} ...

How can I do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:09:35+00:00Added an answer on May 30, 2026 at 3:09 pm

    You may iterate over your data and build the desired structure before JSON.stringify-ing it:

    var data = [{"name":"sEcho","value":1},{"name":"iColumns","value":9},{"name":"sColumns","value":""},{"name":"iDisplayStart","value":0}];
    
    var options = {};
    for (var i=0; i < data.length; i++){
      var key = data[i].name;
      var val = data[i].value;
      options[key] = val;
    }
    
    var jsonString = JSON.stringify(options);
    

    You may also save a couple of lines and make it looks a bit nicer using jQuery each method:

    var options = {};
    $.each(data, function(){
      options[this.name] = this.value;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I started to use the jquery datatables plugin for asp.net mvc2. I have the
I write ASP.NET application and I want to use jQuery DataTables. In Master Page
I use jQuery together with the dataTables Plugin. dataTables provides a feature to open
Does anyone know of any samples that use the DataTables jquery plugin with a
I am using the jQuery plugin DataTables ( http://datatables.net ) for pagination, search capabilities
I'm looking for a easy to use and flexible data table jquery plugin. Any
I have been using the DataTables plugin for jQuery (http://www.datatables.net) to search, sort and
I am trying to use jquery DataTables plugin to display details from my db
I use this: http://datatables.net/release-datatables/examples/api/select_row.html Here is function return selcted rows: function fnGetSelected( oTableLocal )
I am in the process of revising code to use TVP to send data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.