diff --git a/api-test/backend/src/main/java/io/metersphere/commons/utils/JSONToDocumentUtil.java b/api-test/backend/src/main/java/io/metersphere/commons/utils/JSONToDocumentUtil.java index 42664566d5..53c8861afa 100644 --- a/api-test/backend/src/main/java/io/metersphere/commons/utils/JSONToDocumentUtil.java +++ b/api-test/backend/src/main/java/io/metersphere/commons/utils/JSONToDocumentUtil.java @@ -26,6 +26,7 @@ public class JSONToDocumentUtil { List childrenElements = new LinkedList<>(); DocumentElement documentElement = new DocumentElement(StringUtils.EMPTY, PropertyConstant.ARRAY, StringUtils.EMPTY, childrenElements); documentElement.setArrayVerification(true); + documentElement.setName(String.valueOf(i)); children.add(documentElement); jsonDataFormatting((JSONArray) value, childrenElements); } else { diff --git a/api-test/frontend/src/business/definition/components/assertion/document/DocumentBody.vue b/api-test/frontend/src/business/definition/components/assertion/document/DocumentBody.vue index b861034c78..b6e80b94b6 100644 --- a/api-test/frontend/src/business/definition/components/assertion/document/DocumentBody.vue +++ b/api-test/frontend/src/business/definition/components/assertion/document/DocumentBody.vue @@ -618,6 +618,9 @@ export default { row.type = 'object'; } let newRow = this.getNewRow(); + if (row.type === 'array') { + newRow.name = !this.mapData.get(row.id) ? 0 : this.mapData.get(row.id).length; + } newRow.idList = [row.id, newRow.id]; newRow.parentId = row.id; if (this.mapData.has(row.id)) {