Skip to content

Instantly share code, notes, and snippets.

@GoSubRoutine
Last active Nov 8, 2019
Embed
What would you like to do?
JSON Religions
height: 325
{
"religion": [{
"Arceusism": "Worshippers of Arceus, the creator of all Pokémon. See also Giratinism.",
"The Babarambaba Cult": "Worshippers of Mother Nature, personified in a head of lettuce named Ralph.",
"Bajoran religion": "Star Trek: Deep Space Nine.",
"Bandosianism": "RuneScape's war religion.",
"Banjoism": "Elan's religion in The Order of the Stick.",
"Beism": "Giles Goat-Boy, John Barth.",
"Beliar": "Gothic (video game), god of darkness, death and chaos and lord of lightning and earth.",
"Bene Gesserit": "Dune series."
}]
}
<!DOCTYPE html>
<meta charset=UTF-8>
<script async src=https://cdn.JsDelivr.net/npm/p5></script>
<script defer src=sketch.js></script>
/**
* JSON Religions (v1.0)
* GoToLoop (2017-May-05)
*
* https://Forum.Processing.org/two/discussion/22401/
* how-do-i-display-this-data-as-text#Item_4
*
* http://Bl.ocks.org/GoSubRoutine/9aa9cd00000e331612c8e557b5dd28f0
*/
"use strict";
const FILENAME = 'flower.json';
let religions;
function preload() {
loadJSON(FILENAME, ({religion: [obj]}) => religions = obj);
}
function setup() {
noCanvas(), noLoop();
console.table(religions);
for (const key in religions) {
const religion = `<u>${key}</u>: `.bold().big(),
description = religions[key].italics();
createP(religion + description);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment