Skip to content

Reinerth/JSON2Table

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Generate html-table from nested JSON-Object 📃




The way to be used:


1. let myJSON = { ... };
2. let myDOMContainer = document.getElementById("myDOMContainer");
3. JSON2Table.init(myJSON, myDOMContainer);




This is what it look like:

INPUT:

input

OUTPUT:

output

NOTE THIS KNOWN WEAKNESS:


There is a known issue with this script that I couldn't fix yet.
All properties in the JSON must have a unique name,
or the properties with the same name, must be in exactly the same nested order.

If there are two or more properties with the same name and different nested order
the script fails to place them to the right position.

Example:
// This fails, due to the different nested depth of properties with same name
{
    "myProp1": {
        ,"samePropertyName": {
            "prop1": 1
        }
        ,"notWorking": {
            "samePropertyName": {
                "prop1": 1
            }
        }
    }
}
// This still works, due to the same nested depth
{
    "myProp1": {
        ,"workingOne": {
            ,"samePropertyName": {
                "prop1": 1
            }
        }
        ,"workingTwo": {
            "samePropertyName": {
                "prop1": 1
            }
        }
    }
}

About

This little framework generates a htm-table from a nested JSON-Object.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published