Skip to content

JSON_GET_FLOAT

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

bool JSON_GET_FLOAT(JSON *json, const char *name, float *retval)

Description

Retrieves float value from JSON object.

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
{
    float value;

    if ( !JSON_GET_FLOAT(&json, "balance", &value) )
        OUT("Couldn't get balance");
    else
        OUT("<p>Balance: %.2lf</p>", value);
}
Clone this wiki locally