Add the commas to the prettified JSON

I recently came across that when copying the prettified response there were no comma separating the elements. This solves this problem.
This commit is contained in:
Pol 2015-04-14 17:01:01 +02:00
parent 8b6186500a
commit 186d673517

View File

@ -319,7 +319,7 @@
prettifiedJsonString = prettifiedJsonString.replace(/(\{|\[)\n/g, function(match, sectionOpenCharacter) { prettifiedJsonString = prettifiedJsonString.replace(/(\{|\[)\n/g, function(match, sectionOpenCharacter) {
return getJsonCollapseHtml(sectionOpenCharacter) + '<span class="json-collapse-content">\n'; return getJsonCollapseHtml(sectionOpenCharacter) + '<span class="json-collapse-content">\n';
}); });
return prettifiedJsonString.replace(/([^\[][\}\]]),?\n/g, '$1</span>\n'); return prettifiedJsonString.replace(/([^\[][\}\]])(,)?\n/g, '$1$2</span>\n');
}; };
var prettifyResponse = function(text) { var prettifyResponse = function(text) {