JSON Parser  1.0
int default_compare_function_array_values ( const void *  element,
const void *  key 
)

This the default compare function applied to all JSON Array lists, unless an alternative is provided by the caller of parse_json_data_block()

This general purpose compare function evaluates the elements of a specified JSON Array List. It can be used on both JSON Object lists and Array lists. Only use it with JSON Object lists, if you wish to sort the list by value rather than Object Name.

This compare function, unlike the others in the section below, can evaluate all the elements in an array, regardless of their value types.

If two elements are of the same value type, they are compared with each other and the results returned. If the elements are of different value types, the evaluation is performed on the value type itself.

This will yield a sorted list of the following superior orders, from least to most significant (assuming an ascending sort order).

JSON Objects (grouped, but not sorted)
JSON Arrays (grouped, but not sorted)
JSON null values (grouped, but obviously not sorted)
JSON boolean values (sorted)
JSON number values (sorted, mixed types allowed- see note:a)
JSON float string values (sorted - see note:b)
JSON string values (sorted)

This creates a well sorted list that makes logical sense in the context of the values presented. Literal values are sorted within the context of an alphanumeric sort, and given an appropriate value within it.

Note a: JSON Numbers are represented in D-List list elements as either integer or long double variables. For to context of these evaluations the integers are converted to long doubles if the evaluation is between elements of different value types. There is the possibility of a loss of precision, depending on the C implementation and the architecture of the system the code is running on. Any conversion issues would only affect the evaluations, not the actual data items, and would only be a tiny variance of any proper mathematical ordering. Note b: This JSON Parser allows users to prevent the conversion of exponent numbers from a JSON data block, so they may be accessed directly by the users instead, who may wish to use them with library implementations that allow for much higher precision than C99 C ever did. If these exponent numbers were not converted they are left as exponent numbers in text form. They would be sorted as text fields, and placed before any actual text field, preserving some semblance of proper ordering. The sorting performed will not take precision into account for these types of textural exponent numbers, so any such sorting for these special value types, is approximate at best. Most users will never encounter these value types, or usage issues.