--- a/src/cx/json.h Fri Dec 20 15:15:18 2024 +0100 +++ b/src/cx/json.h Fri Dec 20 16:51:01 2024 +0100 @@ -759,7 +759,7 @@ /** * Obtains a C string from the given JSON value. * - * If the value is not a string, the behavior is undefined. + * If the \p value is not a string, the behavior is undefined. * * @param value the JSON value * @return the value represented as C string @@ -774,7 +774,7 @@ /** * Obtains a UCX string from the given JSON value. * - * If the value is not a string, the behavior is undefined. + * If the \p value is not a string, the behavior is undefined. * * @param value the JSON value * @return the value represented as UCX string @@ -788,7 +788,7 @@ /** * Obtains a mutable UCX string from the given JSON value. * - * If the value is not a string, the behavior is undefined. + * If the \p value is not a string, the behavior is undefined. * * @param value the JSON value * @return the value represented as mutable UCX string @@ -802,7 +802,7 @@ /** * Obtains a double-precision floating point value from the given JSON value. * - * If the value is not a JSON number, the behavior is undefined. + * If the \p value is not a JSON number, the behavior is undefined. * * @param value the JSON value * @return the value represented as double @@ -820,7 +820,7 @@ /** * Obtains a 64-bit signed integer from the given JSON value. * - * If the value is not a JSON number, the behavior is undefined. + * If the \p value is not a JSON number, the behavior is undefined. * If it is a JSON number, but not an integer, the value will be * converted to an integer, possibly losing precision. * @@ -841,7 +841,7 @@ /** * Obtains a Boolean value from the given JSON value. * - * If the value is not a JSON literal, the behavior is undefined. + * If the \p value is not a JSON literal, the behavior is undefined. * The \c null literal is interpreted as \c false. * * @param value the JSON value @@ -856,7 +856,7 @@ /** * Returns the size of a JSON array. * - * If the value is not a JSON array, the behavior is undefined. + * If the \p value is not a JSON array, the behavior is undefined. * * @param value the JSON value * @return the size of the array @@ -870,7 +870,7 @@ /** * Returns an element from a JSON array. * - * If the value is not a JSON array, the behavior is undefined. + * If the \p value is not a JSON array, the behavior is undefined. * * This function guarantees to return a value. If the index is * out of bounds, the returned value will be of type @@ -886,9 +886,24 @@ CxJsonValue *cxJsonArrGet(const CxJsonValue *value, size_t index); /** + * Returns an iterator over the JSON array elements. + * + * The iterator yields values of type \c CxJsonValue* . + * + * If the \p value is not a JSON array, the behavior is undefined. + * + * @param value the JSON value + * @return an iterator over the array elements + * @see cxJsonIsArray() + */ +cx_attr_nonnull +cx_attr_nodiscard +CxIterator cxJsonArrIter(const CxJsonValue *value); + +/** * Returns a value corresponding to a key in a JSON object. * - * If the value is not a JSON object, the behavior is undefined. + * If the \p value is not a JSON object, the behavior is undefined. * * This function guarantees to return a JSON value. If the * object does not contain \p name, the returned JSON value