From 68f0a29e44637e8e8d1ef7a8a0356dd3ed1118f5 Mon Sep 17 00:00:00 2001 From: Pablo Custo Date: Mon, 9 Oct 2017 04:00:24 -0300 Subject: [PATCH] Show index number in arrays Show the index number of array's elements --- dist/jquery.jsonview.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dist/jquery.jsonview.js b/dist/jquery.jsonview.js index 4459ee4..f465dfa 100644 --- a/dist/jquery.jsonview.js +++ b/dist/jquery.jsonview.js @@ -78,7 +78,7 @@ Licensed under the MIT License. }; JSONFormatter.prototype.arrayToHTML = function(array, level) { - var collapsible, hasContents, index, numProps, output, value, _i, _len; + var collapsible, hasContents, index, key, numProps, output, value, _i, _len; if (level == null) { level = 0; } @@ -88,7 +88,8 @@ Licensed under the MIT License. for (index = _i = 0, _len = array.length; _i < _len; index = ++_i) { value = array[index]; hasContents = true; - output += '
  • ' + this.valueToHTML(value, level + 1); + key = index; + output += '
  • \"' + key + '\": ' + (this.valueToHTML(value, level + 1)); if (numProps > 1) { output += ','; }