Skip to content

JSON_GET_DOUBLE_A

Jurek Muszyński edited this page Mar 31, 2022 · 4 revisions

bool JSON_GET_DOUBLE_A(JSON *json, int index, double *retval)

Description

Retrieves double value from JSON array.

Returns

TRUE if element has been found, otherwise FALSE.

Example

JSON json={0};

if ( !JSON_FROM_STRING(&json, some_string) )
    OUT("some_string is not a JSON");
else
{
    double value;

    for ( int i=0; i<JSON_COUNT(&json); ++i )
    {
        if ( !JSON_GET_DOUBLE_A(&json, i, &value) )
            OUT("Couldn't get %d-th balance", i);
        else
            OUT("<p>%d-th balance: %.2lf</p>", i, value);
    }
}
Clone this wiki locally