coreJSON v3.2.0
Parser library for the ECMA-404 JSON standard
core_json.c File Reference

The source file that implements the user-facing functions in core_json.h. More...

#include <assert.h>
#include <limits.h>
#include <stddef.h>
#include <stdint.h>
#include "core_json.h"

Functions

JSONStatus_t JSON_Validate (const char *buf, size_t max)
 Parse a buffer to determine if it contains a valid JSON document. More...
 
JSONStatus_t JSON_SearchConst (const char *buf, size_t max, const char *query, size_t queryLength, const char **outValue, size_t *outValueLength, JSONTypes_t *outType)
 Same as JSON_SearchT(), but with const qualified buf and outValue arguments. More...
 
JSONStatus_t JSON_SearchT (char *buf, size_t max, const char *query, size_t queryLength, char **outValue, size_t *outValueLength, JSONTypes_t *outType)
 Same as JSON_Search(), but also outputs a type for the value found. More...
 
JSONStatus_t JSON_Iterate (const char *buf, size_t max, size_t *start, size_t *next, JSONPair_t *outPair)
 Output the next key-value pair or value from a collection. More...
 

Detailed Description

The source file that implements the user-facing functions in core_json.h.

Function Documentation

◆ JSON_Validate()

JSONStatus_t JSON_Validate ( const char *  buf,
size_t  max 
)

Parse a buffer to determine if it contains a valid JSON document.

See core_json.h for docs.

Verify that the entire buffer contains exactly one scalar or collection within optional whitespace.

◆ JSON_SearchConst()

JSONStatus_t JSON_SearchConst ( const char *  buf,
size_t  max,
const char *  query,
size_t  queryLength,
const char **  outValue,
size_t *  outValueLength,
JSONTypes_t outType 
)

Same as JSON_SearchT(), but with const qualified buf and outValue arguments.

See core_json.h for docs.

◆ JSON_SearchT()

JSONStatus_t JSON_SearchT ( char *  buf,
size_t  max,
const char *  query,
size_t  queryLength,
char **  outValue,
size_t *  outValueLength,
JSONTypes_t outType 
)

Same as JSON_Search(), but also outputs a type for the value found.

See core_json.h for docs.

◆ JSON_Iterate()

JSONStatus_t JSON_Iterate ( const char *  buf,
size_t  max,
size_t *  start,
size_t *  next,
JSONPair_t outPair 
)

Output the next key-value pair or value from a collection.

See core_json.h for docs.