Help us shape the future of Go! Take the 2026 Go Developer Survey

cjson

package
v0.5.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 2 Imported by: 1

README

LLGo wrapper of DaveGamble/cJSON

How to install

on macOS (Homebrew)
brew install cjson 
on Linux (Debian/Ubuntu)
apt-get install -y libcjson-dev

Demos

The _demo directory contains our demos (it start with _ to prevent the go command from compiling it):

  • mkjson: create a json object and print it
How to run demos

To run the demos in directory _demo:

cd <demo-directory>  # eg. cd _demo/mkjson
llgo run .

Documentation

Index

Constants

View Source
const (
	LLGoPackage = "link: $(pkg-config --libs libcjson); -lcjson"
)

Variables

This section is empty.

Functions

func Free

func Free(ptr unsafe.Pointer)

CJSON_PUBLIC(void) cJSON_free(void *object);

func FreeCStr

func FreeCStr(*c.Char)

malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks

func GetErrorPtr

func GetErrorPtr() *c.Char

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

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

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.

func Version

func Version() *c.Char

CJSON_PUBLIC(const char*) cJSON_Version(void);

returns the version of cJSON as a string

Types

type Bool

type Bool c.Int

type JSON

type JSON struct {
	Unused [0]byte
}

llgo:type C

func Array

func Array() *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);

func ArrayRef

func ArrayRef(child *JSON) *JSON

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

func CreateArray() *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);

same as Array func

func CreateArrayReference

func CreateArrayReference(child *JSON) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);

same as ArrayRef func

func CreateBool

func CreateBool(boolean c.Int) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_Bool boolean);

same as Bool func

func CreateDoubleArray

func CreateDoubleArray(numbers *c.Double, count c.Int) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count);

func CreateFalse

func CreateFalse() *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);

same as False func

func CreateFloatArray

func CreateFloatArray(numbers *c.Float, count c.Int) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);

func CreateIntArray

func CreateIntArray(numbers *c.Int, count c.Int) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);

func CreateNull

func CreateNull() *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);

same as Null func

func CreateNumber

func CreateNumber(num float64) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);

same as Number func

func CreateObject

func CreateObject() *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);

same as Object func

func CreateObjectReference

func CreateObjectReference(child *JSON) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);

same as ObjectRef func

func CreateRaw

func CreateRaw(raw *c.Char) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);

same as Raw func

func CreateString

func CreateString(str *c.Char) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);

same as String func

func CreateStringArray

func CreateStringArray(strings *c.Char, count c.Int) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count);

func CreateStringReference

func CreateStringReference(str *c.Char) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);

same as StringRef func

func CreateTrue

func CreateTrue() *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);

same as True func

func False

func False() *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);

func Null

func Null() *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);

These calls create a cJSON item of the appropriate type.

func Number

func Number(num float64) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);

func Object

func Object() *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);

func ObjectRef

func ObjectRef(child *JSON) *JSON

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

func Parse(value *c.Char) *JSON

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

func ParseBytes(value []byte) *JSON

func ParseString

func ParseString(value string) *JSON

func ParseWithLength

func ParseWithLength(value *c.Char, valueLength uintptr) *JSON

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

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

func ParseWithOpts(value *c.Char, return_parse_end **c.Char, require_null_terminated Bool) *JSON

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 Raw

func Raw(raw *c.Char) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw); raw json

func String

func String(str *c.Char) *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);

func StringRef

func StringRef(str *c.Char) *JSON

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 True

func True() *JSON

CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);

func (*JSON) AddArrayToObject

func (o *JSON) AddArrayToObject(name *c.Char) *JSON

CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);

llgo:link (*JSON).AddArrayToObject C.cJSON_AddArrayToObject

func (*JSON) AddBoolToObject

func (o *JSON) AddBoolToObject(name *c.Char, b Bool) *JSON

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

func (o *JSON) AddFalseToObject(name *c.Char) *JSON

CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);

llgo:link (*JSON).AddFalseToObject C.cJSON_AddFalseToObject

func (*JSON) AddItem

func (o *JSON) AddItem(item *JSON) Bool

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

func (o *JSON) AddItemReferenceToArray(item *JSON) Bool

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

func (o *JSON) AddItemReferenceToObject(s *c.Char, item *JSON) Bool

CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);

llgo:link (*JSON).AddItemReferenceToObject C.cJSON_AddItemReferenceToObject

func (*JSON) AddItemToArray

func (o *JSON) AddItemToArray(item *JSON) Bool

CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemToArray(cJSON *array, cJSON *item);

same as AddItem func

llgo:link (*JSON).AddItemToArray C.cJSON_AddItemToArray

func (*JSON) AddItemToObject

func (o *JSON) AddItemToObject(key *c.Char, item *JSON) Bool

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

func (o *JSON) AddItemToObjectCS(s *c.Char, item *JSON) Bool

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

func (o *JSON) AddNullToObject(name *c.Char) *JSON

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

func (o *JSON) AddNumberToObject(name *c.Char, num c.Double) *JSON

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

func (o *JSON) AddObjectToObject(name *c.Char) *JSON

CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);

llgo:link (*JSON).AddObjectToObject C.cJSON_AddObjectToObject

func (*JSON) AddRawToObject

func (o *JSON) AddRawToObject(name *c.Char, raw *c.Char) *JSON

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

func (o *JSON) AddStringToObject(name *c.Char, s *c.Char) *JSON

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

func (o *JSON) AddTrueToObject(name *c.Char) *JSON

CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);

llgo:link (*JSON).AddTrueToObject C.cJSON_AddTrueToObject

func (*JSON) CStr

func (o *JSON) CStr() *c.Char

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

func (o *JSON) Compare(b *JSON, case_sensitive Bool) Bool

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) Cstr

func (o *JSON) Cstr() *c.Char

Same as CStr. Provided for Go+.

llgo:link (*JSON).Cstr C.cJSON_PrintUnformatted

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

func (o *JSON) DeleteItemFromArray(which c.Int)

CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);

llgo:link (*JSON).DeleteItemFromArray C.cJSON_DeleteItemFromArray

func (*JSON) DeleteItemFromObject

func (o *JSON) DeleteItemFromObject(s *c.Char)

CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);

llgo:link (*JSON).DeleteItemFromObject C.cJSON_DeleteItemFromObject

func (*JSON) DeleteItemFromObjectCaseSensitive

func (o *JSON) DeleteItemFromObjectCaseSensitive(s *c.Char)

CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);

llgo:link (*JSON).DeleteItemFromObjectCaseSensitive C.cJSON_DeleteItemFromObjectCaseSensitive

func (*JSON) DetachItemFromArray

func (o *JSON) DetachItemFromArray(which c.Int) *JSON

CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);

llgo:link (*JSON).DetachItemFromArray C.cJSON_DetachItemFromArray

func (*JSON) DetachItemFromObject

func (o *JSON) DetachItemFromObject(s *c.Char) *JSON

CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);

llgo:link (*JSON).DetachItemFromObject C.cJSON_DetachItemFromObject

func (*JSON) DetachItemFromObjectCaseSensitive

func (o *JSON) DetachItemFromObjectCaseSensitive(s *c.Char) *JSON

CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);

llgo:link (*JSON).DetachItemFromObjectCaseSensitive C.cJSON_DetachItemFromObjectCaseSensitive

func (*JSON) DetachItemViaPointer

func (o *JSON) DetachItemViaPointer(item *JSON) *JSON

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

func (o *JSON) Duplicate(recurse Bool) *JSON

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

func (o *JSON) GetArrayItem(index c.Int) *JSON

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

func (o *JSON) GetArraySize() c.Int

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

func (o *JSON) GetNumberValue() c.Double

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

func (o *JSON) GetObjectItem(s *c.Char) *JSON

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

func (o *JSON) GetObjectItemCaseSensitive(key *c.Char) *JSON

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

func (o *JSON) GetStringValue() *c.Char

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

func (o *JSON) HasObjectItem(s *c.Char) Bool

CJSON_PUBLIC(cJSON_Bool) cJSON_HasObjectItem(const cJSON *object, const char *string);

llgo:link (*JSON).HasObjectItem C.cJSON_HasObjectItem

func (*JSON) InsertItemInArray

func (o *JSON) InsertItemInArray(which c.Int, newitem *JSON) Bool

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

func (o *JSON) IsArray() Bool

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

func (o *JSON) IsBool() Bool

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

func (o *JSON) IsFalse() Bool

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

func (o *JSON) IsInvalid() Bool

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

func (o *JSON) IsNull() Bool

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

func (o *JSON) IsNumber() Bool

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

func (o *JSON) IsObject() Bool

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

func (o *JSON) IsRaw() Bool

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

func (o *JSON) IsString() Bool

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

func (o *JSON) IsTrue() Bool

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

func (o *JSON) Print() *c.Char

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

func (o *JSON) PrintBuffered(prebuffer c.Int, fmt Bool) *c.Char

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

func (o *JSON) PrintPreallocated(buffer *c.Char, length c.Int, format Bool) Bool

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

func (o *JSON) PrintUnformatted() *c.Char

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

func (o *JSON) ReplaceItemInArray(which c.Int, newitem *JSON) Bool

CJSON_PUBLIC(cJSON_Bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);

llgo:link (*JSON).ReplaceItemInArray C.cJSON_ReplaceItemInArray

func (*JSON) ReplaceItemInObject

func (o *JSON) ReplaceItemInObject(s *c.Char, newitem *JSON) Bool

CJSON_PUBLIC(cJSON_Bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);

llgo:link (*JSON).ReplaceItemInObject C.cJSON_ReplaceItemInObject

func (*JSON) ReplaceItemInObjectCaseSensitive

func (o *JSON) ReplaceItemInObjectCaseSensitive(s *c.Char, newitem *JSON) Bool

CJSON_PUBLIC(cJSON_Bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);

llgo:link (*JSON).ReplaceItemInObjectCaseSensitive C.cJSON_ReplaceItemInObjectCaseSensitive

func (*JSON) ReplaceItemViaPointer

func (o *JSON) ReplaceItemViaPointer(item *JSON, replacement *JSON) Bool

CJSON_PUBLIC(cJSON_Bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);

llgo:link (*JSON).ReplaceItemViaPointer C.cJSON_ReplaceItemViaPointer

func (*JSON) SetItem

func (o *JSON) SetItem(key *c.Char, item *JSON) Bool

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

func (o *JSON) SetNumberHelper(number c.Double) c.Double

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

func (o *JSON) SetValuestring(v *c.Char) *c.Char

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

Directories

Path Synopsis
_demo
mkjson command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL