You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jurek Muszyński edited this page Dec 19, 2021
·
3 revisions
bool JSON_PRESENT(JSON *json, const char *name)
Description
Checks the field's presence in JSON object.
Returns
true if the field is present, otherwise false.
Example
JSON req={0};
if ( !REQ_DATA )
{
OUT("<p>Payload is required.</p>");
returnfalse;
}
if ( !JSON_FROM_STRING(&req, REQ_DATA) )
{
OUT("<p>Payload is not a valid JSON.</p>");
returnfalse;
}
if ( !JSON_PRESENT(&req, "description") )
{
OUT("<p>Description is required in payload.</p>");
returnfalse;
}