ujson
Complete and simple JSON reader and writer written in C
Macros | Enumerations | Functions
ujson_common.h File Reference

Common JSON reader/writer definitions. More...

Go to the source code of this file.

Macros

#define UJSON_ERR_MAX   128
 Maximal error message length.
 
#define UJSON_ID_MAX   64
 Maximal id string lenght including terminating null element.
 
#define UJSON_RECURSION_MAX   128
 Maximal recursion depth allowed.
 
#define UJSON_ARRAY_SIZE(array)   (sizeof(array) / sizeof(*array))
 An array size macro.
 

Enumerations

enum  ujson_type {
  UJSON_VOID = 0 , UJSON_INT , UJSON_FLOAT , UJSON_BOOL ,
  UJSON_NULL , UJSON_STR , UJSON_OBJ , UJSON_ARR
}
 A JSON data type. More...
 

Functions

const char * ujson_type_name (enum ujson_type type)
 Returns type name. More...
 
void ujson_err_handler (void *print_priv, const char *line)
 Default error print handler. More...
 

Detailed Description

Common JSON reader/writer definitions.

Definition in file ujson_common.h.

Enumeration Type Documentation

◆ ujson_type

enum ujson_type

A JSON data type.

Enumerator
UJSON_VOID 

No type. Returned when parser finishes.

UJSON_INT 

An integer.

UJSON_FLOAT 

A floating point.

UJSON_BOOL 

A boolean.

UJSON_NULL 

NULL.

UJSON_STR 

A string.

UJSON_OBJ 

A JSON object.

UJSON_ARR 

A JSON array.

Definition at line 27 of file ujson_common.h.

Function Documentation

◆ ujson_err_handler()

void ujson_err_handler ( void *  print_priv,
const char *  line 
)

Default error print handler.

Parameters
print_privA json buffer print_priv pointer.
lineA line of text to be printed.

◆ ujson_type_name()

const char* ujson_type_name ( enum ujson_type  type)

Returns type name.

Parameters
typeA json type.
Returns
A type name.