![]() |
JSON Parser
1.0
|
| int json_list_object_array_value_add_number | ( | list_object * | list_to_add, |
| const json_integer_t * | integer_number, | ||
| const json_double_t * | double_number, | ||
| const unsigned int | item_count | ||
| ) |
Add a new Number Value to a JSON Array, defined by the list_object provided.
This function will add a new Array Value to the provided list_object at the last position of that list.
One or more values can be provided, either an integer or a fractional number. The arguments take the following precedence,
If double_number[0] == 0, integer_number is used else double_number is used.
which means if the new Number Value has is zero, it will always be added as an integer value. Only the first entry of the input array is checked.
If there are already elements in this list_object, then they are used to confirm that the list_object requested, is actually a JSON Array. If this is the first element to be added, then as no check can be made, it is assumed the caller is providing a Value 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 Number Value to. |
| [in] | integer_number | used as the Value only if double_number[0] == 0, otherwise it is ignored |
| [in] | double_number | used as the Value only if adouble_number[0] != 0, otherwise it is ignored |
| [in] | item_count | The number of these items to add to the JSON Array. It is up to the caller to ensure the count and actual number of values in the input array are consistent. |
| LIST_OK | success, new element(s) added to the list |
| LIST_ERR | on error |