HTML Table to JSON

I have an html code with javascript inside it...

<!DOCTYPE html>
	<title>Table to JSON Example</title>
	<table id="myTable">

	<div id="output"></div>

		function tableToJson(table) {
			var data = [];
			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++) {
					var tableHeader = table.rows[0].cells[j].innerHTML;
					var tableData = tableRow.cells[j].innerHTML;
					rowData[tableHeader] = tableData;
			return data;
		window.onload = function() {
			var table = document.getElementById("myTable");
			var json = tableToJson(table);
			var outputElement = document.getElementById("output");
			outputElement.innerHTML = JSON.stringify(json);

and the output of javascript is this

[  {    "Name": "John",    "Age": "25",    "Gender": "Male"  },  {    "Name": "Jane",    "Age": "30",    "Gender": "Female"  },  {    "Name": "Bob",    "Age": "40",    "Gender": "Male"  }]

and don't know how to run it in the app and get the result of javascript in a label..

please guide me anyone pleae

the js:



can I load html instead of going to URL

the photo is loading from assets.
There is no block for loading html in Webviewer. but you can save the html in ASD, and load the file by "GoToUrl"

1 Like

what if i load html direct or goto link


1 Like

i m laoding webview by url but not working

Please read the community for how to ask a good question.

Only this info, no body can help you.
Show your relevant block here.

1 Like

Looks fine.
Is the Webviewer showing the table correctly?
Is the js string correctly copied?

1 Like

yes both are fine but no result

what's your url?

1 Like

Kerala State Lottery Result Today - Lottery Sambad

Sorry you are scraping data from a website.
Do you have permission for do this from this website?
Otherwise it's against community policy.

1 Like

i m just testing and trying javascript

i can use my website too but i dont have time to make a new html tables page

here is my website

Test (

You already have the solution. Try to understand how it works.

1 Like

im not getting the result in label

It works for the sample you supplied.

1 Like