From d8bc1d7958cc84b33f0a3735375bb498f213bc90 Mon Sep 17 00:00:00 2001 From: Cody Deckard Date: Mon, 23 Jan 2017 20:57:08 -0800 Subject: [PATCH] Adds JSON example to Convert JSON Data to HTML Places JSON example inside a code block in the challenge description for campers to review while they work on the challenge. --- seed/challenges/04-data-visualization/json-apis-and-ajax.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/seed/challenges/04-data-visualization/json-apis-and-ajax.json b/seed/challenges/04-data-visualization/json-apis-and-ajax.json index 90df2296bf..a8042bbc94 100644 --- a/seed/challenges/04-data-visualization/json-apis-and-ajax.json +++ b/seed/challenges/04-data-visualization/json-apis-and-ajax.json @@ -414,7 +414,9 @@ "Here's the code that does this:", "
json.forEach(function(val) {
var keys = Object.keys(val);
html += \"<div class = 'cat'>\";
keys.forEach(function(key) {
html += \"<strong>\" + key + \"</strong>: \" + val[key] + \"<br>\";
});
html += \"</div><br>\";
});
", "
", - "Add a forEach method to loop over the JSON data and create the HTML elements to display it." + "Add a forEach method to loop over the JSON data and create the HTML elements to display it.", + "Here is some example JSON", + "
[
{
\"id\":0,
\"imageLink\":\"https://s3.amazonaws.com/freecodecamp/funny-cat.jpg\",
\"altText\":\"A white cat wearing a green helmet shaped melon on it's head. \",
\"codeNames\":[
\"Juggernaut\",
\"Mrs. Wallace\",
\"Buttercup\"
]
}
]
" ], "challengeSeed": [ "