diff --git a/demos/demo_json_init_with_mustache/index-jsonfromform.html b/demos/demo_json_init_with_mustache/index-jsonfromform.html index 346dab3..c1ec50b 100644 --- a/demos/demo_json_init_with_mustache/index-jsonfromform.html +++ b/demos/demo_json_init_with_mustache/index-jsonfromform.html @@ -84,13 +84,20 @@

Blapy Block results in a Table

window.setColorToData = function(aJson) { - aJson = aJson.map( (aData) => { + var aJsonArray = []; + if (!Array.isArray(aJson)) + aJsonArray[0] = aJson; + else + aJsonArray = aJson; + + aJson = aJsonArray.map( (aData) => { if (aData.firstname == "John") aData["colorFirstName"] = "green"; else aData["colorFirstName"] = "blue"; if (aData.lastname == "Rabbit") aData["colorLastName"] = "red"; else aData["colorLastName"] = "cyan"; return aData; }); + return aJson; }