Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

How to make the following table into a JSON string in jquery/javascript?

<table>  <thead> <tr><th>Column <tr>  <th>Column 1</th><th>Columnth> <th>Column 2</th><th>Columnth>  <th>Column 3</th><th> </tr>  </thead>  <tbody> <tr><td>A1< <tr> <td>A1</td><td>A2<td> <td>A2</td><td>A3<td> <td>A3</td><td> </tr> <tr><td>B1< <tr> <td>B1</td><td>B2<td> <td>B2</td><td>B3<td> <td>B3</td><td> </tr> <tr><td>C1< <tr> <td>C1</td><td>C2<td> <td>C2</td><td>C3<td> <td>C3</td><td> </tr>  </tbody> </table> 

I want to make it such that I can get a JSON string in a variable "myjson" that could be used in a POST request or GET request:

{  "myrows" : [ { "Column 1" : "A1",  "Column 2" : "A2",  "Column 3" : "A3" },  { "Column 1" : "B1",  "Column 2" : "B2",  "Column 3" : "B3" },  { "Column 1" : "C1",  "Column 2" : "C2",  "Column 3" : "C3" } ] } 

What is the best way to accomplish this? (Note: There may be a varying number of rows, I just want to extract the text while ignoring the other tags inside of the table)

How to make the following table into a JSON string in jquery/javascript?

<table> <thead> <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr> </thead> <tbody> <tr><td>A1</td><td>A2</td><td>A3</td></tr> <tr><td>B1</td><td>B2</td><td>B3</td></tr> <tr><td>C1</td><td>C2</td><td>C3</td></tr> </tbody> </table> 

I want to make it such that I can get a JSON string in a variable "myjson" that could be used in a POST request or GET request:

{ "myrows":[{"Column 1" : "A1", "Column 2" : "A2", "Column 3" : "A3"}, {"Column 1" : "B1", "Column 2" : "B2", "Column 3" : "B3"}, {"Column 1" : "C1", "Column 2" : "C2", "Column 3" : "C3"}] } 

What is the best way to accomplish this? (Note: There may be a varying number of rows, I just want to extract the text while ignoring the other tags inside of the table)

How to make the following table into a JSON string in jquery/javascript?

<table>  <thead>  <tr>  <th>Column 1</th> <th>Column 2</th>  <th>Column 3</th> </tr>  </thead>  <tbody>  <tr> <td>A1</td> <td>A2</td> <td>A3</td> </tr>  <tr> <td>B1</td> <td>B2</td> <td>B3</td> </tr>  <tr> <td>C1</td> <td>C2</td> <td>C3</td> </tr>  </tbody> </table> 

I want to make it such that I can get a JSON string in a variable "myjson" that could be used in a POST request or GET request:

{  "myrows" : [ { "Column 1" : "A1",  "Column 2" : "A2",  "Column 3" : "A3" },  { "Column 1" : "B1",  "Column 2" : "B2",  "Column 3" : "B3" },  { "Column 1" : "C1",  "Column 2" : "C2",  "Column 3" : "C3" } ] } 

What is the best way to accomplish this? (Note: There may be a varying number of rows, I just want to extract the text while ignoring the other tags inside of the table)

added 203 characters in body
Source Link
Rolando
  • 63.3k
  • 104
  • 288
  • 424

How to make the following table into a JSON string in jquery/javascript?

<table> <thead> <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr> </thead> <tbody> <tr><td>A1</td><td>A2</td><td>A3</td></tr> <tr><td>B1</td><td>B2</td><td>B3</td></tr> <tr><td>C1</td><td>C2</td><td>C3</td></tr> </tbody> </table> 

I want to make it such that I can get a JSON string in a variable "myjson" that could be used in a POST request or GET request:

{ "myrows":[{"Column 1" : "A1", "Column 2" : "A2", "Column 3" : "A3"}, {"Column 1" : "B1", "Column 2" : "B2", "Column 3" : "B3"}, {"Column 1" : "C1", "Column 2" : "C2", "Column 3" : "C3"}] } 

What is the best way to accomplish this? (Note: There may be a varying number of rows, I just want to extract the text while ignoring the other tags inside of the table)

How to make the following table into a JSON string in jquery/javascript?

<table> <thead> <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr> </thead> <tbody> <tr><td>A1</td><td>A2</td><td>A3</td></tr> <tr><td>B1</td><td>B2</td><td>B3</td></tr> <tr><td>C1</td><td>C2</td><td>C3</td></tr> </tbody> </table> 

I want to make it such that I can get a JSON string in a variable "myjson" that could be used in a POST request or GET request:

{ "myrows":[{"Column 1" : "A1", "Column 2" : "A2", "Column 3" : "A3"}, {"Column 1" : "B1", "Column 2" : "B2", "Column 3" : "B3"}, {"Column 1" : "C1", "Column 2" : "C2", "Column 3" : "C3"}] } 

What is the best way to accomplish this? (Note: There may be a varying number of rows)

How to make the following table into a JSON string in jquery/javascript?

<table> <thead> <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr> </thead> <tbody> <tr><td>A1</td><td>A2</td><td>A3</td></tr> <tr><td>B1</td><td>B2</td><td>B3</td></tr> <tr><td>C1</td><td>C2</td><td>C3</td></tr> </tbody> </table> 

I want to make it such that I can get a JSON string in a variable "myjson" that could be used in a POST request or GET request:

{ "myrows":[{"Column 1" : "A1", "Column 2" : "A2", "Column 3" : "A3"}, {"Column 1" : "B1", "Column 2" : "B2", "Column 3" : "B3"}, {"Column 1" : "C1", "Column 2" : "C2", "Column 3" : "C3"}] } 

What is the best way to accomplish this? (Note: There may be a varying number of rows, I just want to extract the text while ignoring the other tags inside of the table)

added 2 characters in body
Source Link
Álvaro González
  • 147.3k
  • 45
  • 282
  • 378

How to make the following table into a JSON objectstring in jquery/javascript?

<table> <thead> <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr> </thead> <tbody> <tr><td>A1</td><td>A2</td><td>A3</td></tr> <tr><td>B1</td><td>B2</td><td>B3</td></tr> <tr><td>C1</td><td>C2</td><td>C3</td></tr> </tbody> </table> 

I want to make it such that I can get a JSON string in a variable "myjson" that could be used in a POST request or GET request:

{ "myrows":[{"Column 1" : "A1", "Column 2" : "A2", "Column 3" : "A3"}, {"Column 1" : "B1", "Column 2" : "B2", "Column 3" : "B3"}, {"Column 1" : "C1", "Column 2" : "C2", "Column 3" : "C3"}] } 

What is the best way to accomplish this? (Note: There may be a varying number of rows)

How to make the following table into a JSON object in jquery/javascript?

<table> <thead> <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr> </thead> <tbody> <tr><td>A1</td><td>A2</td><td>A3</td></tr> <tr><td>B1</td><td>B2</td><td>B3</td></tr> <tr><td>C1</td><td>C2</td><td>C3</td></tr> </tbody> </table> 

I want to make it such that I can get a JSON string in variable "myjson" that could be used in a POST request or GET request:

{ "myrows":[{"Column 1" : "A1", "Column 2" : "A2", "Column 3" : "A3"}, {"Column 1" : "B1", "Column 2" : "B2", "Column 3" : "B3"}, {"Column 1" : "C1", "Column 2" : "C2", "Column 3" : "C3"}] } 

What is the best way to accomplish this? (Note: There may be a varying number of rows)

How to make the following table into a JSON string in jquery/javascript?

<table> <thead> <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr> </thead> <tbody> <tr><td>A1</td><td>A2</td><td>A3</td></tr> <tr><td>B1</td><td>B2</td><td>B3</td></tr> <tr><td>C1</td><td>C2</td><td>C3</td></tr> </tbody> </table> 

I want to make it such that I can get a JSON string in a variable "myjson" that could be used in a POST request or GET request:

{ "myrows":[{"Column 1" : "A1", "Column 2" : "A2", "Column 3" : "A3"}, {"Column 1" : "B1", "Column 2" : "B2", "Column 3" : "B3"}, {"Column 1" : "C1", "Column 2" : "C2", "Column 3" : "C3"}] } 

What is the best way to accomplish this? (Note: There may be a varying number of rows)

added 3 characters in body
Source Link
Rolando
  • 63.3k
  • 104
  • 288
  • 424
Loading
deleted 11 characters in body
Source Link
Álvaro González
  • 147.3k
  • 45
  • 282
  • 378
Loading
added 46 characters in body
Source Link
Rolando
  • 63.3k
  • 104
  • 288
  • 424
Loading
added 44 characters in body
Source Link
Matt
  • 75.4k
  • 26
  • 156
  • 181
Loading
added 70 characters in body
Source Link
Rolando
  • 63.3k
  • 104
  • 288
  • 424
Loading
edited tags
Link
Adrien Schuler
  • 2.4k
  • 1
  • 22
  • 32
Loading
Source Link
Rolando
  • 63.3k
  • 104
  • 288
  • 424
Loading