json.h: Add ast_json_object_real_get.

json.h contains macros to get a string and an integer
from a JSON object. However, the macro to do this for
JSON reals is missing. This adds that.

ASTERISK-30361 #close

Change-Id: I8d0e28d763febf27b05801cdc83b73282aa6ee7a
This commit is contained in:
Naveen Albert 2022-12-16 18:25:52 +00:00 committed by Friendly Automation
parent 82d5239bcb
commit fb8ee4f14a
1 changed files with 9 additions and 0 deletions

View File

@ -592,6 +592,15 @@ struct ast_json *ast_json_object_get(struct ast_json *object, const char *key);
*/
#define ast_json_object_integer_get(object, key) ast_json_integer_get(ast_json_object_get(object, key))
/*!
* \brief Get a double field from a JSON object.
* \param object JSON object.
* \param key Key of double field to look up.
* \return Value of a JSON double.
* \retval 0 if \a real is not a JSON real number.
*/
#define ast_json_object_real_get(object, key) ast_json_real_get(ast_json_object_get(object, key))
/*!
* \brief Set a field in a JSON object.
* \since 12.0.0