libcmutils 0.6.5
Multi-platform C99 utility library
Loading...
Searching...
No Matches
CMUTIL_JsonObject Struct Reference

JSON object. More...

Data Fields

CMUTIL_Json parent
 
CMUTIL_StringArray *(* GetKeys )(const CMUTIL_JsonObject *jobj)
 Get the keys of the JSON object.
 
CMUTIL_Json *(* Get )(const CMUTIL_JsonObject *jobj, const char *key)
 Get the value associated with a key in the JSON object.
 
int64_t(* GetLong )(const CMUTIL_JsonObject *jobj, const char *key)
 Get the long integer value associated with a key in the JSON object.
 
double(* GetDouble )(const CMUTIL_JsonObject *jobj, const char *key)
 Get the double value associated with a key in the JSON object.
 
const CMUTIL_String *(* GetString )(const CMUTIL_JsonObject *jobj, const char *key)
 Get the string value associated with a key in the JSON object.
 
const char *(* GetCString )(const CMUTIL_JsonObject *jobj, const char *key)
 Get the C-style string value associated with a key in the JSON object.
 
CMBool(* GetBoolean )(const CMUTIL_JsonObject *jobj, const char *key)
 Get the boolean value associated with a key in the JSON object.
 
void(* Put )(CMUTIL_JsonObject *jobj, const char *key, CMUTIL_Json *json)
 Put a JSON object into the JSON object with a key.
 
void(* PutLong )(CMUTIL_JsonObject *jobj, const char *key, int64_t value)
 Put a long integer value into the JSON object with a key.
 
void(* PutDouble )(CMUTIL_JsonObject *jobj, const char *key, double value)
 Put a double value into the JSON object with a key.
 
void(* PutString )(CMUTIL_JsonObject *jobj, const char *key, const char *value)
 Put a string value into the JSON object with a key.
 
void(* PutBoolean )(CMUTIL_JsonObject *jobj, const char *key, CMBool value)
 Put a boolean value into the JSON object with a key.
 
void(* PutNull )(CMUTIL_JsonObject *jobj, const char *key)
 Put a null value into the JSON object with a key.
 
CMUTIL_Json *(* Remove )(CMUTIL_JsonObject *jobj, const char *key)
 Remove a key-value pair from the JSON object.
 
void(* Delete )(CMUTIL_JsonObject *jobj, const char *key)
 Delete a key-value pair from the JSON object.
 

Detailed Description

JSON object.

Must be destroyed with CMUTIL_JsonDestroy.

Field Documentation

◆ parent

CMUTIL_Json CMUTIL_JsonObject::parent

JSON base object.

◆ GetKeys

CMUTIL_StringArray *(* CMUTIL_JsonObject::GetKeys) (const CMUTIL_JsonObject *jobj)

Get the keys of the JSON object.

This method retrieves the keys of the JSON object as a string array. The caller must destroy the returned CMUTIL_StringArray after use.

Parameters
jobjThe JSON object to get the keys from.
Returns
A pointer to a CMUTIL_StringArray containing the keys.

◆ Get

CMUTIL_Json *(* CMUTIL_JsonObject::Get) (const CMUTIL_JsonObject *jobj, const char *key)

Get the value associated with a key in the JSON object.

This method retrieves the value associated with the specified key in the JSON object.

Parameters
jobjThe JSON object to get the value from.
keyThe key whose associated value is to be retrieved.
Returns
A pointer to the CMUTIL_Json value associated with the key.

◆ GetLong

int64_t(* CMUTIL_JsonObject::GetLong) (const CMUTIL_JsonObject *jobj, const char *key)

Get the long integer value associated with a key in the JSON object.

This method retrieves the long integer value associated with the specified key in the JSON object.

Parameters
jobjThe JSON object to get the long integer from.
keyThe key whose associated long integer value is to be retrieved.
Returns
The long integer value associated with the key.

◆ GetDouble

double(* CMUTIL_JsonObject::GetDouble) (const CMUTIL_JsonObject *jobj, const char *key)

Get the double value associated with a key in the JSON object.

This method retrieves the double value associated with the specified key in the JSON object.

Parameters
jobjThe JSON object to get the double from.
keyThe key whose associated double value is to be retrieved.
Returns
The double value associated with the key.

◆ GetString

const CMUTIL_String *(* CMUTIL_JsonObject::GetString) (const CMUTIL_JsonObject *jobj, const char *key)

Get the string value associated with a key in the JSON object.

This method retrieves the string value associated with the specified key in the JSON object.

Parameters
jobjThe JSON object to get the string from.
keyThe key whose associated string value is to be retrieved.
Returns
A pointer to the CMUTIL_String containing the string value.

◆ GetCString

const char *(* CMUTIL_JsonObject::GetCString) (const CMUTIL_JsonObject *jobj, const char *key)

Get the C-style string value associated with a key in the JSON object.

This method retrieves the C-style string value associated with the specified key in the JSON object.

Parameters
jobjThe JSON object to get the C-style string from.
keyThe key whose associated C-style string value is to be retrieved.
Returns
A pointer to the C-style string.

◆ GetBoolean

CMBool(* CMUTIL_JsonObject::GetBoolean) (const CMUTIL_JsonObject *jobj, const char *key)

Get the boolean value associated with a key in the JSON object.

This method retrieves the boolean value associated with the specified key in the JSON object.

Parameters
jobjThe JSON object to get the boolean value from.
keyThe key whose associated boolean value is to be retrieved.
Returns
CMTrue if the value is true, CMFalse otherwise.

◆ Put

void(* CMUTIL_JsonObject::Put) (CMUTIL_JsonObject *jobj, const char *key, CMUTIL_Json *json)

Put a JSON object into the JSON object with a key.

This method adds or updates a JSON object with the specified key in the JSON object. If the key already exists, the existing value is replaced.

Parameters
jobjThe JSON object to put the JSON value into.
keyThe key to associate with the JSON value.
jsonThe JSON value to be put.

◆ PutLong

void(* CMUTIL_JsonObject::PutLong) (CMUTIL_JsonObject *jobj, const char *key, int64_t value)

Put a long integer value into the JSON object with a key.

This method adds or updates a long integer value with the specified key in the JSON object. If the key already exists, the existing value is replaced.

Parameters
jobjThe JSON object to put the long integer value into.
keyThe key to associate with the long integer value.
valueThe long integer value to be put.

◆ PutDouble

void(* CMUTIL_JsonObject::PutDouble) (CMUTIL_JsonObject *jobj, const char *key, double value)

Put a double value into the JSON object with a key.

This method adds or updates a double value with the specified key in the JSON object. If the key already exists, the existing value is replaced.

Parameters
jobjThe JSON object to put the double value into.
keyThe key to associate with the double value.
valueThe double value to be put.

◆ PutString

void(* CMUTIL_JsonObject::PutString) (CMUTIL_JsonObject *jobj, const char *key, const char *value)

Put a string value into the JSON object with a key.

This method adds or updates a string value with the specified key in the JSON object. If the key already exists, the existing value is replaced.

Parameters
jobjThe JSON object to put the string value into.
keyThe key to associate with the string value.
valueThe string value to be put.

◆ PutBoolean

void(* CMUTIL_JsonObject::PutBoolean) (CMUTIL_JsonObject *jobj, const char *key, CMBool value)

Put a boolean value into the JSON object with a key.

This method adds or updates a boolean value with the specified key in the JSON object. If the key already exists, the existing value is replaced.

Parameters
jobjThe JSON object to put the boolean value into.
keyThe key to associate with the boolean value.
valueThe boolean value to be put.

◆ PutNull

void(* CMUTIL_JsonObject::PutNull) (CMUTIL_JsonObject *jobj, const char *key)

Put a null value into the JSON object with a key.

This method adds or updates a null value with the specified key in the JSON object. If the key already exists, the existing value is replaced.

Parameters
jobjThe JSON object to put the null value into.
keyThe key to associate with the null value.

◆ Remove

CMUTIL_Json *(* CMUTIL_JsonObject::Remove) (CMUTIL_JsonObject *jobj, const char *key)

Remove a key-value pair from the JSON object.

This method removes the key-value pair associated with the specified key from the JSON object. If the key does not exist, no action is taken. Ownership of the removed JSON value is transferred to the caller.

Parameters
jobjThe JSON object to remove the key-value pair from.
keyThe key to remove.
Returns
The removed JSON value, or NULL if the key does not exist.

◆ Delete

void(* CMUTIL_JsonObject::Delete) (CMUTIL_JsonObject *jobj, const char *key)

Delete a key-value pair from the JSON object.

This method deletes the key-value pair associated with the specified key from the JSON object. If the key does not exist, no action is taken.

Parameters
jobjThe JSON object to delete the key-value pair from.
keyThe key to delete.

The documentation for this struct was generated from the following file: