Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/isayme/tjson
a tiny JSON parser written in LINUX C.
https://github.com/isayme/tjson
Last synced: 12 days ago
JSON representation
a tiny JSON parser written in LINUX C.
- Host: GitHub
- URL: https://github.com/isayme/tjson
- Owner: isayme
- License: mit
- Created: 2014-08-21T16:34:06.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-09-05T08:22:34.000Z (over 10 years ago)
- Last Synced: 2024-04-16T14:21:46.654Z (8 months ago)
- Language: C
- Size: 195 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## tJson ##
A tiny JSON parser written in LINUX C.## APIs ##
```
// parse json from metadata
tjson_value *tjson_parse_data(const char *json_data);// parse json from file
tjson_value *tjson_parse_file(const char *path);// free memory of a json object
void tjson_value_free(tjson_value **root);
``````
// get type of a json object
tjson_valuetype tjson_gettype(const tjson_value *value);// json object type check
int tjson_isstring(const tjson_value *value);
int tjson_isnumber(const tjson_value *value);
int tjson_isboolean(const tjson_value *value);
int tjson_isnull(const tjson_value *value);
int tjson_isobject(const tjson_value *value);
int tjson_isarray(const tjson_value *value);
int tjson_iserror(const tjson_value *value);
```
```
// return string pointer of a `string` type json object, otherwise return NULL.
const char *tjson_value_string(const tjson_value *value);// return number value of a `number` type json object, otherwise return 0.
double tjson_value_number(const tjson_value *value);// return boolean value of a `boolean` type json object, otherwise return -1.
int tjson_value_boolean(const tjson_value *value);// return 1 if value is `null` type, otherwise return -1.
int tjson_value_null(const tjson_value *value);// return json object pointer specified by `key`.
tjson_value *tjson_value_object(const tjson_value *value, const char *key);// return json object pointer specified by `index`.
tjson_value *tjson_value_array(const tjson_value *value, int index);
```