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

  • Home
  • SEARCH
  • 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 6726703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:57:31+00:00 2026-05-26T09:57:31+00:00

I need to frame a json object from an html table with all the

  • 0

I need to frame a json object from an html table with all the cells in each rows of the table. i.e,

if my html table consists of 10 rows, 10 columns each for a row, i need to create a json object with all the 10 rows and the data within the 10 columns. How can this be possible with a json object?

Is it possible to save this big object to the db on a single click?

Help Please. Thank You.

  • 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-26T09:57:31+00:00Added an answer on May 26, 2026 at 9:57 am

    Use this method:

    function tableToJson(table) {
        var data = []; // first row needs to be headers var headers = [];
        for (var i = 0; i < table.rows[0].cells.length; i++) {
            headers[i] = table.rows[0].cells[i].innerHTML.toLowerCase().replace(/ /gi, '');
        }
        // go through cells
        for (var i = 1; i < table.rows.length; i++) {
            var tableRow = table.rows[i]; var rowData = {};
            for (var j = 0; j < tableRow.cells.length; j++) {
                rowData[headers[j]] = tableRow.cells[j].innerHTML;
            } data.push(rowData);
        }
        return data;
    }
    

    Courtesy: http://johndyer.name/html-table-to-json/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get a stack frame of a function from any PDB (All
I need to look up rows within a particular time frame. select * from
I need to create something like internal frame in netbeans platform , which loads
I need to access and element from within a frameset frame. For example if
I need the UIGraphicsBeginImageContext(self.view.frame.size); changed to where the .frame part pulls from webView -
I need to send a JSON string to a number of TCP clients from
I read periodically 16-bit frames from a file, last frame I need to know
I have a class which derived from wx.frame and need to attach it to
I need to read a data frame from a file containing NULL values. Here's
I have a list filter = ['a', 'b', 'c']. I need to frame the

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.