Documentation ¶
Index ¶
- Constants
- func Free(ptr unsafe.Pointer)
- func FreeCStr(*c.Char)
- func GetErrorPtr() *c.Char
- func Malloc(size uintptr)
- func Minify()
- func Version() *c.Char
- type Bool
- type JSON
- func Array() *JSON
- func ArrayRef(child *JSON) *JSON
- func CreateArray() *JSON
- func CreateArrayReference(child *JSON) *JSON
- func CreateBool(boolean c.Int) *JSON
- func CreateDoubleArray(numbers *c.Double, count c.Int) *JSON
- func CreateFalse() *JSON
- func CreateFloatArray(numbers *c.Float, count c.Int) *JSON
- func CreateIntArray(numbers *c.Int, count c.Int) *JSON
- func CreateNull() *JSON
- func CreateNumber(num float64) *JSON
- func CreateObject() *JSON
- func CreateObjectReference(child *JSON) *JSON
- func CreateRaw(raw *c.Char) *JSON
- func CreateString(str *c.Char) *JSON
- func CreateStringArray(strings *c.Char, count c.Int) *JSON
- func CreateStringReference(str *c.Char) *JSON
- func CreateTrue() *JSON
- func False() *JSON
- func Null() *JSON
- func Number(num float64) *JSON
- func Object() *JSON
- func ObjectRef(child *JSON) *JSON
- func Parse(value *c.Char) *JSON
- func ParseBytes(value []byte) *JSON
- func ParseString(value string) *JSON
- func ParseWithLength(value *c.Char, valueLength uintptr) *JSON
- func ParseWithLengthOpts(value *c.Char, buffer_length uintptr, return_parse_end **c.Char, ...) *JSON
- func ParseWithOpts(value *c.Char, return_parse_end **c.Char, require_null_terminated Bool) *JSON
- func Raw(raw *c.Char) *JSON
- func String(str *c.Char) *JSON
- func StringRef(str *c.Char) *JSON
- func True() *JSON
- func (o *JSON) AddArrayToObject(name *c.Char) *JSON
- func (o *JSON) AddBoolToObject(name *c.Char, b Bool) *JSON
- func (o *JSON) AddFalseToObject(name *c.Char) *JSON
- func (o *JSON) AddItem(item *JSON) Bool
- func (o *JSON) AddItemReferenceToArray(item *JSON) Bool
- func (o *JSON) AddItemReferenceToObject(s *c.Char, item *JSON) Bool
- func (o *JSON) AddItemToArray(item *JSON) Bool
- func (o *JSON) AddItemToObject(key *c.Char, item *JSON) Bool
- func (o *JSON) AddItemToObjectCS(s *c.Char, item *JSON) Bool
- func (o *JSON) AddNullToObject(name *c.Char) *JSON
- func (o *JSON) AddNumberToObject(name *c.Char, num c.Double) *JSON
- func (o *JSON) AddObjectToObject(name *c.Char) *JSON
- func (o *JSON) AddRawToObject(name *c.Char, raw *c.Char) *JSON
- func (o *JSON) AddStringToObject(name *c.Char, s *c.Char) *JSON
- func (o *JSON) AddTrueToObject(name *c.Char) *JSON
- func (o *JSON) CStr() *c.Char
- func (o *JSON) Compare(b *JSON, case_sensitive Bool) Bool
- func (o *JSON) Cstr() *c.Char
- func (o *JSON) Delete()
- func (o *JSON) DeleteItemFromArray(which c.Int)
- func (o *JSON) DeleteItemFromObject(s *c.Char)
- func (o *JSON) DeleteItemFromObjectCaseSensitive(s *c.Char)
- func (o *JSON) DetachItemFromArray(which c.Int) *JSON
- func (o *JSON) DetachItemFromObject(s *c.Char) *JSON
- func (o *JSON) DetachItemFromObjectCaseSensitive(s *c.Char) *JSON
- func (o *JSON) DetachItemViaPointer(item *JSON) *JSON
- func (o *JSON) Duplicate(recurse Bool) *JSON
- func (o *JSON) GetArrayItem(index c.Int) *JSON
- func (o *JSON) GetArraySize() c.Int
- func (o *JSON) GetNumberValue() c.Double
- func (o *JSON) GetObjectItem(s *c.Char) *JSON
- func (o *JSON) GetObjectItemCaseSensitive(key *c.Char) *JSON
- func (o *JSON) GetStringValue() *c.Char
- func (o *JSON) HasObjectItem(s *c.Char) Bool
- func (o *JSON) InsertItemInArray(which c.Int, newitem *JSON) Bool
- func (o *JSON) IsArray() Bool
- func (o *JSON) IsBool() Bool
- func (o *JSON) IsFalse() Bool
- func (o *JSON) IsInvalid() Bool
- func (o *JSON) IsNull() Bool
- func (o *JSON) IsNumber() Bool
- func (o *JSON) IsObject() Bool
- func (o *JSON) IsRaw() Bool
- func (o *JSON) IsString() Bool
- func (o *JSON) IsTrue() Bool
- func (o *JSON) Print() *c.Char
- func (o *JSON) PrintBuffered(prebuffer c.Int, fmt Bool) *c.Char
- func (o *JSON) PrintPreallocated(buffer *c.Char, length c.Int, format Bool) Bool
- func (o *JSON) PrintUnformatted() *c.Char
- func (o *JSON) ReplaceItemInArray(which c.Int, newitem *JSON) Bool
- func (o *JSON) ReplaceItemInObject(s *c.Char, newitem *JSON) Bool
- func (o *JSON) ReplaceItemInObjectCaseSensitive(s *c.Char, newitem *JSON) Bool
- func (o *JSON) ReplaceItemViaPointer(item *JSON, replacement *JSON) Bool
- func (o *JSON) SetItem(key *c.Char, item *JSON) Bool
- func (o *JSON) SetNumberHelper(number c.Double) c.Double
- func (o *JSON) SetValuestring(v *c.Char) *c.Char
Constants ¶
const (
LLGoPackage = "link: $(pkg-config --libs libcjson); -lcjson"
)
Variables ¶
This section is empty.
Functions ¶
func FreeCStr ¶ added in v0.9.3
malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks
func GetErrorPtr ¶ added in v0.9.8
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds.
func Malloc ¶ added in v0.9.8
func Malloc(size uintptr)
CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks
func Minify ¶ added in v0.9.8
func Minify()
CJSON_PUBLIC(void) cJSON_Minify(char *json);
Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings. The input pointer json cannot point to a read-only address area, such as a string constant, but should point to a readable and writable address area.
Types ¶
type JSON ¶
type JSON struct {
Unused [0]byte
}
llgo:type C
func ArrayRef ¶
CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
Create an array that only references it's elements so they will not be freed by Delete
func CreateArray ¶ added in v0.9.8
func CreateArray() *JSON
CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
same as Array func
func CreateArrayReference ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
same as ArrayRef func
func CreateBool ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_Bool boolean);
same as Bool func
func CreateDoubleArray ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count);
func CreateFalse ¶ added in v0.9.8
func CreateFalse() *JSON
CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);
same as False func
func CreateFloatArray ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
func CreateIntArray ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
func CreateNull ¶ added in v0.9.8
func CreateNull() *JSON
CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
same as Null func
func CreateNumber ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);
same as Number func
func CreateObject ¶ added in v0.9.8
func CreateObject() *JSON
CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
same as Object func
func CreateObjectReference ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
same as ObjectRef func
func CreateRaw ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);
same as Raw func
func CreateString ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);
same as String func
func CreateStringArray ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count);
func CreateStringReference ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
same as StringRef func
func CreateTrue ¶ added in v0.9.8
func CreateTrue() *JSON
CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);
same as True func
func Null ¶
func Null() *JSON
CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
These calls create a cJSON item of the appropriate type.
func ObjectRef ¶
CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
Create an object that only references it's elements so they will not be freed by Delete
func Parse ¶ added in v0.9.3
CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value);
Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer.
func ParseBytes ¶ added in v0.9.3
func ParseString ¶ added in v0.9.3
func ParseWithLength ¶ added in v0.9.3
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length);
Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer.
func ParseWithLengthOpts ¶ added in v0.9.8
func ParseWithLengthOpts(value *c.Char, buffer_length uintptr, return_parse_end **c.Char, require_null_terminated Bool) *JSON
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_Bool require_null_terminated);
ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr().
func ParseWithOpts ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_Bool require_null_terminated);
ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr().
func StringRef ¶
CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
Create a string where valuestring references a string so it will not be freed by Delete
func (*JSON) AddArrayToObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
llgo:link (*JSON).AddArrayToObject C.cJSON_AddArrayToObject
func (*JSON) AddBoolToObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_Bool boolean);
llgo:link (*JSON).AddBoolToObject C.cJSON_AddBoolToObject
func (*JSON) AddFalseToObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
llgo:link (*JSON).AddFalseToObject C.cJSON_AddFalseToObject
func (*JSON) AddItem ¶
CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemToArray(cJSON *array, cJSON *item);
Append item to the specified array.
llgo:link (*JSON).AddItem C.cJSON_AddItemToArray
func (*JSON) AddItemReferenceToArray ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON.
llgo:link (*JSON).AddItemReferenceToArray C.cJSON_AddItemReferenceToArray
func (*JSON) AddItemReferenceToObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
llgo:link (*JSON).AddItemReferenceToObject C.cJSON_AddItemReferenceToObject
func (*JSON) AddItemToArray ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemToArray(cJSON *array, cJSON *item);
same as AddItem func
llgo:link (*JSON).AddItemToArray C.cJSON_AddItemToArray
func (*JSON) AddItemToObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
same as SetItem func
llgo:link (*JSON).AddItemToObject C.cJSON_AddItemToObject
func (*JSON) AddItemToObjectCS ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object. warning that When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before writing to `item->string`
llgo:link (*JSON).AddItemToObjectCS C.cJSON_AddItemToObjectCS
func (*JSON) AddNullToObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
Helper functions for creating and adding items to an object at the same time. They return the added item or NULL on failure.
llgo:link (*JSON).AddNullToObject C.cJSON_AddNullToObject
func (*JSON) AddNumberToObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number);
llgo:link (*JSON).AddNumberToObject C.cJSON_AddNumberToObject
func (*JSON) AddObjectToObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);
llgo:link (*JSON).AddObjectToObject C.cJSON_AddObjectToObject
func (*JSON) AddRawToObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw);
llgo:link (*JSON).AddRawToObject C.cJSON_AddRawToObject
func (*JSON) AddStringToObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string);
llgo:link (*JSON).AddStringToObject C.cJSON_AddStringToObject
func (*JSON) AddTrueToObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
llgo:link (*JSON).AddTrueToObject C.cJSON_AddTrueToObject
func (*JSON) CStr ¶
CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
Render a cJSON entity to text for transfer/storage without any formatting.
llgo:link (*JSON).CStr C.cJSON_PrintUnformatted
func (*JSON) Compare ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_Bool case_sensitive);
Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal. case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0)
llgo:link (*JSON).Compare C.cJSON_Compare
func (*JSON) Delete ¶
func (o *JSON) Delete()
CJSON_PUBLIC(void) cJSON_Delete(cJSON *item); Delete a JSON entity and all subentities.
llgo:link (*JSON).Delete C.cJSON_Delete
func (*JSON) DeleteItemFromArray ¶ added in v0.9.8
CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
llgo:link (*JSON).DeleteItemFromArray C.cJSON_DeleteItemFromArray
func (*JSON) DeleteItemFromObject ¶ added in v0.9.8
CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
llgo:link (*JSON).DeleteItemFromObject C.cJSON_DeleteItemFromObject
func (*JSON) DeleteItemFromObjectCaseSensitive ¶ added in v0.9.8
CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
llgo:link (*JSON).DeleteItemFromObjectCaseSensitive C.cJSON_DeleteItemFromObjectCaseSensitive
func (*JSON) DetachItemFromArray ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
llgo:link (*JSON).DetachItemFromArray C.cJSON_DetachItemFromArray
func (*JSON) DetachItemFromObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);
llgo:link (*JSON).DetachItemFromObject C.cJSON_DetachItemFromObject
func (*JSON) DetachItemFromObjectCaseSensitive ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
llgo:link (*JSON).DetachItemFromObjectCaseSensitive C.cJSON_DetachItemFromObjectCaseSensitive
func (*JSON) DetachItemViaPointer ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
Remove/Detach items from Arrays/Objects.
llgo:link (*JSON).DetachItemViaPointer C.cJSON_DetachItemViaPointer
func (*JSON) Duplicate ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_Bool recurse);
Duplicate a cJSON item
Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will need to be released. With recurse!=0, it will duplicate any children connected to the item. The item->next and ->prev pointers are always zero on return from Duplicate.
llgo:link (*JSON).Duplicate C.cJSON_Duplicate
func (*JSON) GetArrayItem ¶ added in v0.9.4
CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
Retrieve item number "index" from array "array". Returns NULL if unsuccessful.
llgo:link (*JSON).GetArrayItem C.cJSON_GetArrayItem
func (*JSON) GetArraySize ¶ added in v0.9.4
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
Returns the number of items in an array (or object).
llgo:link (*JSON).GetArraySize C.cJSON_GetArraySize
func (*JSON) GetNumberValue ¶ added in v0.9.8
CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item);
Check item type and return its value
llgo:link (*JSON).GetNumberValue C.cJSON_GetNumberValue
func (*JSON) GetObjectItem ¶ added in v0.9.8
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
Get item "string" from object. Case insensitive.
llgo:link (*JSON).GetObjectItem C.cJSON_GetObjectItem
func (*JSON) GetObjectItemCaseSensitive ¶ added in v0.9.4
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string);
Get item "string" from object. Case sensitive.
llgo:link (*JSON).GetObjectItemCaseSensitive C.cJSON_GetObjectItemCaseSensitive
func (*JSON) GetStringValue ¶ added in v0.9.4
CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item);
Check item type and return its value
llgo:link (*JSON).GetStringValue C.cJSON_GetStringValue
func (*JSON) HasObjectItem ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
llgo:link (*JSON).HasObjectItem C.cJSON_HasObjectItem
func (*JSON) InsertItemInArray ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem);
Update array items. Shifts pre-existing items to the right.
llgo:link (*JSON).InsertItemInArray C.cJSON_InsertItemInArray
func (*JSON) IsArray ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_IsArray(const cJSON * const item);
These functions check the type of an item
llgo:link (*JSON).IsArray C.cJSON_IsArray
func (*JSON) IsBool ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_IsBool(const cJSON * const item);
These functions check the type of an item
llgo:link (*JSON).IsBool C.cJSON_IsBool
func (*JSON) IsFalse ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_IsFalse(const cJSON * const item);
These functions check the type of an item
llgo:link (*JSON).IsFalse C.cJSON_IsFalse
func (*JSON) IsInvalid ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_IsInvalid(const cJSON * const item);
These functions check the type of an item
llgo:link (*JSON).IsInvalid C.cJSON_IsInvalid
func (*JSON) IsNull ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_IsNull(const cJSON * const item);
These functions check the type of an item
llgo:link (*JSON).IsNull C.cJSON_IsNull
func (*JSON) IsNumber ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_IsNumber(const cJSON * const item);
These functions check the type of an item
llgo:link (*JSON).IsNumber C.cJSON_IsNumber
func (*JSON) IsObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_IsObject(const cJSON * const item);
These functions check the type of an item
llgo:link (*JSON).IsObject C.cJSON_IsObject
func (*JSON) IsRaw ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_IsRaw(const cJSON * const item);
These functions check the type of an item
llgo:link (*JSON).IsRaw C.cJSON_IsRaw
func (*JSON) IsString ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_IsString(const cJSON * const item);
These functions check the type of an item
llgo:link (*JSON).IsString C.cJSON_IsString
func (*JSON) IsTrue ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_IsTrue(const cJSON * const item);
These functions check the type of an item
llgo:link (*JSON).IsTrue C.cJSON_IsTrue
func (*JSON) Print ¶
CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item); Render a JSON entity to text for transfer/storage.
llgo:link (*JSON).Print C.cJSON_Print
func (*JSON) PrintBuffered ¶
CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_Bool fmt);
Render a JSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted.
llgo:link (*JSON).PrintBuffered C.cJSON_PrintBuffered
func (*JSON) PrintPreallocated ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_Bool format);
Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. note that cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need
llgo:link (*JSON).PrintPreallocated C.cJSON_PrintPreallocated
func (*JSON) PrintUnformatted ¶
CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item); Render a JSON entity to text for transfer/storage without any formatting.
llgo:link (*JSON).PrintUnformatted C.cJSON_PrintUnformatted
func (*JSON) ReplaceItemInArray ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
llgo:link (*JSON).ReplaceItemInArray C.cJSON_ReplaceItemInArray
func (*JSON) ReplaceItemInObject ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
llgo:link (*JSON).ReplaceItemInObject C.cJSON_ReplaceItemInObject
func (*JSON) ReplaceItemInObjectCaseSensitive ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
llgo:link (*JSON).ReplaceItemInObjectCaseSensitive C.cJSON_ReplaceItemInObjectCaseSensitive
func (*JSON) ReplaceItemViaPointer ¶ added in v0.9.8
CJSON_PUBLIC(cJSON_Bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
llgo:link (*JSON).ReplaceItemViaPointer C.cJSON_ReplaceItemViaPointer
func (*JSON) SetItem ¶
CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
Append item to the specified object.
llgo:link (*JSON).SetItem C.cJSON_AddItemToObject
func (*JSON) SetNumberHelper ¶ added in v0.9.8
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
helper for the cJSON_SetNumberValue macro
llgo:link (*JSON).SetNumberHelper C.cJSON_SetNumberHelper
func (*JSON) SetValuestring ¶ added in v0.9.8
CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring);
Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String
llgo:link (*JSON).SetValuestring C.cJSON_SetValuestring