coreJSON  v1.0.0
A parser strictly enforcing the ECMA-404 JSON standard, suitable for microcontrollers
core_json.c File Reference

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

#include <assert.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_Search (char *buf, size_t max, const char *queryKey, size_t queryKeyLength, char separator, char **outValue, size_t *outValueLength)
 Find a key in a JSON object and output the pointer outValue to its value. 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_Search()

JSONStatus_t JSON_Search ( char *  buf,
size_t  max,
const char *  queryKey,
size_t  queryKeyLength,
char  separator,
char **  outValue,
size_t *  outValueLength 
)

Find a key in a JSON object and output the pointer outValue to its value.

See core_json.h for docs.

Handle a nested search by iterating over the parts of the queryKey.