afshinm / json-to-html-table Goto Github PK
View Code? Open in Web Editor NEWSimple Json to standard HTML table converter in fastest way
Home Page: http://afshinm.github.com/Json-to-HTML-Table/
Simple Json to standard HTML table converter in fastest way
Home Page: http://afshinm.github.com/Json-to-HTML-Table/
Hi,
I am trying to use the library in my code but doesn't display anything?
<title></title> <script type="text/javascript" src="jsontohtml.js"></script> <div>
<?php
// echo $jsonResult;
error_reporting(E_ALL);
ini_set("display_errors", 1);
include 'include/weather_data.php';
include 'include/getJson.php';
$jsonValue = new getjson();
$table = 'WEATHER_SIMPLE_FORECAST';
$jsonResult = $jsonValue->getJsonData($table);
print_r($jsonResult);
?>
<script type="text/javascript">
var jsonHtmlTable = ConvertJsonToTable(eval([$jsonResult]), 'jsonTable', null, 'Download');
document.write(jsonHtmlTable);
</script>
</div>
</body>
Could you please tell me what am i doing wrong?
Thanks
My JSON object looks like the following:
var myJSON = {
key1 : val1
,key2 : val2
,key3 : {subkey1 : subval1, subkey2 : subval2, subkey3 : subval3}
}
When I run your function like so:
var disp = $('#DEBUG_AREA');
var jsonTable = ConvertJsonToTable(eval([myJSON]), "jsonData", null, 'Download');
disp.append(jsonTable);
For the key3 cell, I see [object Object]. I was expecting to see a nested table showing the structure of that particular sub-object. What parts of the code would be changed to allow for this feature?
Thanks!
you could be more specific in the readme
Hi,
it would be great to turn the orientation around.
Your: Output id:
ke1 key2
val1 val2
but i need:
key1 val1
key2 val2
greetz,
ps
Hi,
thanks for great lib I have used it for a while one.. and I stumbled upon change I would like to have..
I need to remove thead block from table completely so to have all in rows (tr) appended to tbody element...
I tried to alter lines 67, 70 where var th and thRow are to td and tbody but it somehow parsed wrong..
Do you have some idea how to go with that ?
thanks, krex
All the date values in the cell , show null. i check the json string which has the following value
someDate":{"year":2012,"month":12,"day":17,"timezone":-360,"hour":0,"minute":0,"second":0,"fractionalSecond":0.000}
this value is shown as null in the table.
To get multiple rows to work I added 'var i' and 'var j' to create local loop variables.
It seems disapear for a while...
I only get the top level objects in the display results.
Nesting not working?
library works with jsonarrays but It does not work for me using json objects
jsonData={"x":1,"y":2,"z":3};
var jsonHtmlTable = ConvertJsonToTable(jsonData, 'jsonTable', null, 'Download');
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="jsontohtml.js"></script>
</head>
<body>
<div>
<?php
// echo $jsonResult;
error_reporting(E_ALL);
ini_set("display_errors", 1);
include 'include/weather_data.php';
include 'include/getJson.php';
$jsonValue = new getjson();
$table = 'WEATHER_SIMPLE_FORECAST';
$jsonResult = $jsonValue->getJsonData($table);
print_r($jsonResult);
?>
<script type="text/javascript">
var jsonHtmlTable = ConvertJsonToTable(eval([$jsonResult]), 'jsonTable', null, 'Download');
document.write(jsonHtmlTable);
</script>
</div>
</body>
</html>
Could you please tell me why is it not displaying anything?
Thanks
I am trying JSON to html on the following JSON, and I am receiving empty table in the output. Any idea what I maybe missing here?
var jsonData = {"ConsumedCapacityUnits":0.5,"Item":{"FirstName":{"S":"Joe"},"LastName":{"S":"Smith"}}};
var htmlOutput = ConvertJsonToTable(jsonData); //Empty html table is returned here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.