![]() |
JSON Parser
1.0
|
| int json_list_object_member_add_number | ( | list_object * | list_to_add, |
| const char * | member_name, | ||
| const json_integer_t | integer_number, | ||
| const json_double_t | double_number | ||
| ) |
Add a new Member with a number value to a JSON Object, defined by the list_object provided.
This function will add a new JSON Member to the provided list_object at the last position of that list.
Only one value item can be provided, either an integer or a fractional number. The arguments take the following precedence,
If double_number == 0, integer_number is used else double_number is used.
which means if the new Member has a value of zero, it will always be added as an integer value.
If there are already elements in this list_object, then they are used to confirm that the list_object requested, is actually a JSON Object. If this is the first element to be added, then as no check can be made, it is assumed the caller is providing a Member to a valid JSON list type. If the list type is incorrect, an error will be thrown up when the second element is added.
| [in] | list_to_add | the list_object of the JSON data hierarchy to add the new Member to. |
| [in] | member_name | pointer to a nul terminated string to use as the JSON Object Member Name, this argument is required both by this function, and by JSON Standards RFC 8259. |
| [in] | integer_number | used as the Member value only if a) string_value is NULL, and b) double_number == 0, otherwise it is ignored |
| [in] | double_number | used as the Member value only if a) string_value is NULL, and b) this argument is non-zero, otherwise it is ignored |
| LIST_OK | success, new element added to the list |
| LIST_ERR | on error |