Fixed type 'array' not being identified as base object

This commit is contained in:
RogerBernardo
2017-02-03 09:02:33 -02:00
parent 2afe6a81d5
commit 8ce2f1c7e9

View File

@@ -123,12 +123,16 @@ function convert () {
changeIndentation(1); changeIndentation(1);
//For each object inside the JSON //For each object inside the JSON
for (var obj in inJSON) { for (var obj in inJSON) {
if (typeof inJSON[obj] === "object") { if (typeof inJSON[obj] === "object") {
// ---- Begin object scope ---- // ---- Begin object scope ----
outSwagger += indentator + '"' + obj + '": {' outSwagger += indentator + '"' + obj + '": {'
changeIndentation(tabCount+1); changeIndentation(tabCount+1);
convertObject(inJSON[obj], obj); if (Object.prototype.toString.call(inJSON[obj]) === '[object Array]') {
// ---- End object scope ---- convertArray(inJSON[obj][0], obj);
} else {
convertObject(inJSON[obj], obj);
}
// ---- End object scope ----
changeIndentation(tabCount-1); changeIndentation(tabCount-1);
outSwagger += indentator + '},'; outSwagger += indentator + '},';
} }