Json print implementation for sds.
More...
#include "dist/sds/sds.h"
#include <stdbool.h>
Go to the source code of this file.
|
| sds | json_comma (sds buffer) |
| |
| sds | tojson_raw (sds buffer, const char *key, const char *value, bool comma) |
| |
| sds | tojson_sds (sds buffer, const char *key, sds value, bool comma) |
| |
| sds | tojson_char (sds buffer, const char *key, const char *value, bool comma) |
| |
| sds | tojson_char_len (sds buffer, const char *key, const char *value, size_t len, bool comma) |
| |
| sds | tojson_bool (sds buffer, const char *key, bool value, bool comma) |
| |
| sds | tojson_int (sds buffer, const char *key, int value, bool comma) |
| |
| sds | tojson_uint (sds buffer, const char *key, unsigned value, bool comma) |
| |
| sds | tojson_time (sds buffer, const char *key, time_t value, bool comma) |
| |
| sds | tojson_float (sds buffer, const char *key, float value, bool comma) |
| |
| sds | tojson_int64 (sds buffer, const char *key, int64_t value, bool comma) |
| |
| sds | tojson_uint64 (sds buffer, const char *key, uint64_t value, bool comma) |
| |
Json print implementation for sds.
◆ json_comma()
| sds json_comma |
( |
sds |
buffer | ) |
|
This unit provides functions for json printing Appends a comma on demand. Comma is omitted on start of string or end of string is already a comma.
- Parameters
-
| buffer | sds string to append |
- Returns
- pointer to buffer
◆ tojson_bool()
| sds tojson_bool |
( |
sds |
buffer, |
|
|
const char * |
key, |
|
|
bool |
value, |
|
|
bool |
comma |
|
) |
| |
Prints a json key/value pair for a bool value
- Parameters
-
| buffer | sds string to append |
| key | json key |
| value | bool value |
| comma | true to append a comma |
- Returns
- pointer to buffer
◆ tojson_char()
| sds tojson_char |
( |
sds |
buffer, |
|
|
const char * |
key, |
|
|
const char * |
value, |
|
|
bool |
comma |
|
) |
| |
Prints a json key/value pair for 0-terminated char values value is encoded as json
- Parameters
-
| buffer | sds string to append |
| key | json key |
| value | to encode as json |
| comma | true to append a comma |
- Returns
- pointer to buffer
◆ tojson_char_len()
| sds tojson_char_len |
( |
sds |
buffer, |
|
|
const char * |
key, |
|
|
const char * |
value, |
|
|
size_t |
len, |
|
|
bool |
comma |
|
) |
| |
Prints a json key/value pair for not 0-terminated values value is encoded as json
- Parameters
-
| buffer | sds string to append |
| key | json key |
| value | as sds string to encode as json |
| len | length of value |
| comma | true to append a comma |
- Returns
- pointer to buffer
◆ tojson_float()
| sds tojson_float |
( |
sds |
buffer, |
|
|
const char * |
key, |
|
|
float |
value, |
|
|
bool |
comma |
|
) |
| |
Prints a json key/value pair for a float value
- Parameters
-
| buffer | sds string to append |
| key | json key |
| value | double value |
| comma | true to append a comma |
- Returns
- pointer to buffer
◆ tojson_int()
| sds tojson_int |
( |
sds |
buffer, |
|
|
const char * |
key, |
|
|
int |
value, |
|
|
bool |
comma |
|
) |
| |
Prints a json key/value pair for an int value
- Parameters
-
| buffer | sds string to append |
| key | json key |
| value | integer value |
| comma | true to append a comma |
- Returns
- pointer to buffer
◆ tojson_int64()
| sds tojson_int64 |
( |
sds |
buffer, |
|
|
const char * |
key, |
|
|
int64_t |
value, |
|
|
bool |
comma |
|
) |
| |
Prints a json key/value pair for an int64_t value
- Parameters
-
| buffer | sds string to append |
| key | json key |
| value | int64_t value |
| comma | true to append a comma |
- Returns
- pointer to buffer
◆ tojson_raw()
| sds tojson_raw |
( |
sds |
buffer, |
|
|
const char * |
key, |
|
|
const char * |
value, |
|
|
bool |
comma |
|
) |
| |
Prints a json key/value pair for already encoded values value is printed raw without any encoding done
- Parameters
-
| buffer | sds string to append |
| key | json key |
| value | raw data |
| comma | true to append a comma |
- Returns
- pointer to buffer
◆ tojson_sds()
| sds tojson_sds |
( |
sds |
buffer, |
|
|
const char * |
key, |
|
|
sds |
value, |
|
|
bool |
comma |
|
) |
| |
Prints a json key/value pair for sds values value is encoded as json
- Parameters
-
| buffer | sds string to append |
| key | json key |
| value | as sds string to encode as json |
| comma | true to append a comma |
- Returns
- pointer to buffer
◆ tojson_time()
| sds tojson_time |
( |
sds |
buffer, |
|
|
const char * |
key, |
|
|
time_t |
value, |
|
|
bool |
comma |
|
) |
| |
Prints a json key/value pair for a time_t value
- Parameters
-
| buffer | sds string to append |
| key | json key |
| value | time_t value |
| comma | true to append a comma |
- Returns
- pointer to buffer
◆ tojson_uint()
| sds tojson_uint |
( |
sds |
buffer, |
|
|
const char * |
key, |
|
|
unsigned |
value, |
|
|
bool |
comma |
|
) |
| |
Prints a json key/value pair for an unsigned
- Parameters
-
| buffer | sds string to append |
| key | json key |
| value | unsigned integer value |
| comma | true to append a comma |
- Returns
- pointer to buffer
◆ tojson_uint64()
| sds tojson_uint64 |
( |
sds |
buffer, |
|
|
const char * |
key, |
|
|
uint64_t |
value, |
|
|
bool |
comma |
|
) |
| |
Prints a json key/value pair for an uint64_t value
- Parameters
-
| buffer | sds string to append |
| key | json key |
| value | uint64_t value |
| comma | true to append a comma |
- Returns
- pointer to buffer