WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
json.h File Reference
#include <stddef.h>

Go to the source code of this file.

Classes

struct  jsmntok
struct  jsmn_parser

Macros

#define JSMN_API   extern

Typedefs

typedef struct jsmntok jsmntok_t
typedef struct jsmn_parser jsmn_parser

Enumerations

enum  jsmntype_t {
  JSMN_UNDEFINED = 0 , JSMN_OBJECT = 1 << 0 , JSMN_ARRAY = 1 << 1 , JSMN_STRING = 1 << 2 ,
  JSMN_PRIMITIVE = 1 << 3
}
enum  jsmnerr { JSMN_ERROR_NOMEM = -1 , JSMN_ERROR_INVAL = -2 , JSMN_ERROR_PART = -3 }

Functions

void jsmn_init (jsmn_parser *parser)
int jsmn_parse (jsmn_parser *parser, const char *js, const size_t len, jsmntok_t *tokens, const unsigned int num_tokens)

Macro Definition Documentation

◆ JSMN_API

#define JSMN_API   extern

Typedef Documentation

◆ jsmn_parser

typedef struct jsmn_parser jsmn_parser

JSON parser. Contains an array of token blocks available. Also stores the string being parsed now and current position in that string.

◆ jsmntok_t

typedef struct jsmntok jsmntok_t

JSON token description. type type (object, array, string etc.) start start position in JSON data string end end position in JSON data string

Enumeration Type Documentation

◆ jsmnerr

enum jsmnerr
Enumerator
JSMN_ERROR_NOMEM 
JSMN_ERROR_INVAL 
JSMN_ERROR_PART 

◆ jsmntype_t

enum jsmntype_t

JSON type identifier. Basic types are: o Object o Array o String o Other primitive: number, boolean (true/false) or null

Enumerator
JSMN_UNDEFINED 
JSMN_OBJECT 
JSMN_ARRAY 
JSMN_STRING 
JSMN_PRIMITIVE 

Function Documentation

◆ jsmn_init()

void jsmn_init ( jsmn_parser * parser)
extern

Create JSON parser over an array of tokens

Creates a new parser based over a given buffer with an array of tokens available.

◆ jsmn_parse()

int jsmn_parse ( jsmn_parser * parser,
const char * js,
const size_t len,
jsmntok_t * tokens,
const unsigned int num_tokens )
extern

Run JSON parser. It parses a JSON data string into and array of tokens, each describing a single JSON object.

Parse JSON string and fill tokens.