I have external JSON at location /data/words.json
{
"sports": ["golf", "hockey", "football"],
"animals": ["giraffe", "snake", "lizard", "puma"],
"video games": ["pacman", "asteroids", "super mario brothers", "donkey kong"]
}
I need to access this in my javascript function. I have loaded the file as follows:
<script type="text/javascript" src="./data/words.json"></script>
How can I print all the keys of given JSON and print it on browser? Note that provided JSON does not have a variable name.