Diego Stucchi / jsmn_plus

Dependents:   jsmn_testing

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers jsmn_utils.h Source File

jsmn_utils.h

00001 #ifndef JSMN_UTILS_H
00002 #define JSMN_UTILS_H
00003 
00004 #include "jsmn.h"
00005 #include <stdlib.h>
00006 #include <stdbool.h>
00007 
00008 void    jsmn_error(int err_code);
00009 
00010 // Getters (if the token is an array, it uses idx)
00011 jsmntok_t*    jsmn_get_token(char* json_string, jsmntok_t* token, char* target);
00012 
00013 void          jsmn_get_string(char* json_string, jsmntok_t* token, char* target, int idx, char* dest);
00014 int           jsmn_get_integer(char* json_string, jsmntok_t* token, char* target, int idx);
00015 unsigned long jsmn_get_ulong(char* json_string, jsmntok_t* token, char* target, int idx);
00016 bool          jsmn_get_boolean(char* json_string, jsmntok_t* token, char* target, int idx);
00017 
00018 void          jsmn_get_integer_array(char* json_string, jsmntok_t* token, char* target, int* destination);
00019 void          jsmn_get_ulong_array(char* json_string, jsmntok_t* token, char* target, unsigned long* destination);
00020 void          jsmn_get_boolean_array(char* json_string, jsmntok_t* token, char* target, bool* destination);
00021 
00022 size_t        jsmn_get_string_length(char* json_string, jsmntok_t* token, char *target, int idx);
00023 
00024 // Printers
00025 jsmntok_t* jsmn_print_token(char *json_string, jsmntok_t *token);
00026 void       jsmn_print_object(char *json_string);
00027 
00028 #endif