diff --git a/docs/widgets/services/customapi.md b/docs/widgets/services/customapi.md index 95d2e0551..bd43a93d6 100644 --- a/docs/widgets/services/customapi.md +++ b/docs/widgets/services/customapi.md @@ -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 ``` diff --git a/src/widgets/customapi/component.jsx b/src/widgets/customapi/component.jsx index 282cb0a5f..52a27be94 100644 --- a/src/widgets/customapi/component.jsx +++ b/src/widgets/customapi/component.jsx @@ -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; }