jwt_helpers_get_grp(3)
π jwt_helpers_get_grp π
okay bestie, so this is a page from the Library Functions Manual for jwt_helpers_get_grp β and yes the function name is giving "get the group" but it's actually the Getters page π«Ά it's all about pulling values out of a JWT, and honestly? it's iconic.
β¨ NAME β¨
jwt_helpers_get_grp β Getters. that's it, that's the name. short, sweet, slays. π
πΈ SYNOPSIS πΈ
Macros π
#define jwt_set_GET_INT(__v, __n)
Setup a jwt_value_t to get an integer value.
#define jwt_set_GET_STR(__v, __n)
Setup a jwt_value_t to get a string value.
#define jwt_set_GET_BOOL(__v, __n)
Setup a jwt_value_t to get a boolean value.
#define jwt_set_GET_JSON(__v, __n)
Setup a jwt_value_t to get a JSON string.
four macros, four vibes, all of them little setup helpers π
π Detailed Description π
so here's the tea π: when you're getting a value, you must set type and name. that's not optional, that's the rules. and on a successful return, the value specific to the type gets filled in for you. cute, right? π
the common error responses for this function are:
JWT_VALUE_ERR_NOEXISTβ when thenamedoesn't exist. it's literally not there bestie πJWT_VALUE_ERR_TYPEβ when the named object isn't the type you asked for (like, you requested a string but it's actually an integer value?? not the vibe π)
π Remarks
when you're getting a JSON value, you can set value.name = NULL, and in that case the entire header is returned. also β and this is important, no cap β the resulting value.json_val will be using allocated memory and must be freed by the caller. don't forget to free it, bestie, or that memory is just gonna sit there. free it. periodt. π§
β Note
normally JSON comes back in compact form. but if you set jwt_value_t.pretty, you get a tabbed format suitable for human viewing πβ¨ and you have to set this after calling jwt_set_GET_JSON(). after, okay? after. π
jwt_value_error_t ret;
jwt_value_t jval;
jwt_set_GET_INT(&jval, "h1");
ret = jwt_builder_claim_get(builder, &jval);
if (ret == JWT_VALUE_ERR_NONE)
printf("h1 = %d\n", jval.int_val);
look at that. h1 goes in, JWT_VALUE_ERR_NONE comes out, and we print. main character energy honestly π₯
π¦ Macro Definition Documentation π¦
π #define jwt_set_GET_BOOL( __v, __n)
Value:
({ \
(__v)->type=JWT_VALUE_BOOL; \
(__v)->name=(__n);(__v)->bool_val=0;(__v)->error=0;\
(__v);})
Setup a jwt_value_t to get a boolean value. π₯
Parameters
__vβ Pointer to ajwt_value_tobject__nβ Name of the value
Returns
No return value.
π #define jwt_set_GET_INT( __v, __n)
Value:
({ \
(__v)->type=JWT_VALUE_INT; \
(__v)->name=(__n);(__v)->int_val=0;(__v)->error=0;\
(__v);})
Setup a jwt_value_t to get an integer value. π’
Parameters
__vβ Pointer to ajwt_value_tobject__nβ Name of the value
Returns
No return value.
π #define jwt_set_GET_JSON( __v, __n)
Value:
({ \
(__v)->type=JWT_VALUE_JSON;(__v)->pretty=0; \
(__v)->name=(__n);(__v)->json_val=NULL;(__v)->error=0;\
(__v);})
Setup a jwt_value_t to get a JSON string. π and yup, it zeroes out pretty for you β remember the Note up there, you flip that after calling this one π
Parameters
__vβ Pointer to ajwt_value_tobject__nβ Name of the value
Returns
No return value.
π #define jwt_set_GET_STR( __v, __n)
Value:
({ \
(__v)->type=JWT_VALUE_STR; \
(__v)->name=(__n);(__v)->str_val=NULL;(__v)->error=0;\
(__v);})
Setup a jwt_value_t to get a string value. π
Parameters
__vβ Pointer to ajwt_value_tobject__nβ Name of the value
Returns
No return value.
π Author π
Generated automatically by Doxygen for LibJWT from the source code. (not me writing any of this by hand, the robots did it π€β¨)
and that's the whole page bestie!! π
LibJWT, Version 3.3.3, and this was jwt_helpers_get_grp(3) β go forth and get those values, and please free your json_val πΈπ«Άπ
π¦ where this page comes from
- ubuntu stonking: libjwt14-doc 3.3.3-1build1 Β· MPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms