mirror of
https://github.com/rafagafe/tiny-json.git
synced 2025-03-12 19:25:30 +00:00
Update README
This commit is contained in:
parent
cac8c847b7
commit
e628e40f01
@ -24,7 +24,7 @@ Two types are defined in tiny-json API. One is jsonType_t. It is an enumeration
|
|||||||
```C
|
```C
|
||||||
typedef enum {
|
typedef enum {
|
||||||
JSON_OBJ, JSON_ARRAY, JSON_TEXT, JSON_BOOLEAN,
|
JSON_OBJ, JSON_ARRAY, JSON_TEXT, JSON_BOOLEAN,
|
||||||
JSON_INTEGER, JSON_REAL, JSON_SCIENTIFIC, JSON_NULL
|
JSON_INTEGER, JSON_REAL, JSON_NULL
|
||||||
} jsonType_t;
|
} jsonType_t;
|
||||||
```
|
```
|
||||||
To parse a JSON string we use the function json_create(). We pass it an array of json_t for it can allocate JSON fields.
|
To parse a JSON string we use the function json_create(). We pass it an array of json_t for it can allocate JSON fields.
|
||||||
@ -57,7 +57,7 @@ if ( agefield == NULL ) return EXIT_FAILURE;
|
|||||||
if ( json_getType( agefield ) != JSON_INTEGER ) return EXIT_FAILURE;
|
if ( json_getType( agefield ) != JSON_INTEGER ) return EXIT_FAILURE;
|
||||||
|
|
||||||
int64_t agevalue = json_getInteger( agefield );
|
int64_t agevalue = json_getInteger( agefield );
|
||||||
printf( "%s%ll%s", "Age: '", agevalue, "'.\n" );
|
printf( "%s%lld%s", "Age: '", agevalue, "'.\n" );
|
||||||
|
|
||||||
char const* agetxt = json_getValue( agefield );
|
char const* agetxt = json_getValue( agefield );
|
||||||
printf( "%s%s%s", "Age: '", agetxt, "'.\n" );
|
printf( "%s%s%s", "Age: '", agetxt, "'.\n" );
|
||||||
|
Loading…
Reference in New Issue
Block a user