Change: Use the absence of "field" to refer to the root of customapi response

This commit is contained in:
Jacobo de Vera
2024-08-26 23:47:34 +01:00
parent 9b79d71ac7
commit 7b069cc51f
2 changed files with 3 additions and 3 deletions

View File

@@ -57,8 +57,8 @@ widget:
- field: key
label: Number of things in array
format: size
- field: . # This will take the root of the API response, e.g. when APIs return an array
label: Number of items
# This (no field) will take the root of the API response, e.g. when APIs return an array:
- label: Number of items
format: size
```

View File

@@ -20,7 +20,7 @@ function getValue(field, data) {
let key = "";
// Support APIs that return arrays or scalars directly.
if (field === ".") {
if (typeof field === "undefined") {
return value;
}