cjson

package module
v0.1.1 Latest Latest
Warning

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

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

README

cJSON

LLGo bindings for cJSON 1.7.19.

Installation

Install LLGo first, then install cJSON, its optional libcjson_utils library, and pkg-config for your platform. The binding links to both libraries through pkg-config.

These bindings are generated from cJSON 1.7.19, and the tests expect that exact library version. Package manager versions vary; if yours differs, use the source installation below to match the bindings.

macOS (Homebrew)
brew install cjson pkg-config
Linux

Ubuntu / Debian (libcjson-dev):

sudo apt update
sudo apt install libcjson-dev pkg-config

Fedora (cjson-devel):

sudo dnf install cjson-devel pkgconf-pkg-config

Arch Linux (cjson):

sudo pacman -S cjson pkgconf

Verify that your package provides both libcjson.pc and libcjson_utils.pc. Some older distribution packages build only the core library; use the source installation below with -DENABLE_CJSON_UTILS=ON in that case.

Windows

Set up the matching LLGo toolchain and pkg-config using the LLGo Windows guide, then install cJSON for the same architecture and ABI.

For MinGW, run the following in an MSYS2 CLANG64 shell (amd64):

pacman -S mingw-w64-clang-x86_64-cjson mingw-w64-clang-x86_64-pkgconf

For arm64, use a CLANGARM64 shell and replace mingw-w64-clang-x86_64- with mingw-w64-clang-aarch64-. See the MSYS2 cJSON packages. Keep the matching clang64/bin or clangarm64/bin directory on PATH when building and running programs so the cJSON DLL can be found.

For MSVC, install cJSON with your configured vcpkg (run from its directory in PowerShell):

.\vcpkg.exe install cjson:x64-windows pkgconf:x64-windows

Use arm64-windows instead of x64-windows for arm64. Configure pkg-config to use that triplet's metadata and add its bin directory to PATH, as described in the LLGo Windows guide. Keep MSVC and MinGW libraries in their respective toolchain environments.

If using WSL, follow the Linux instructions inside your WSL distribution and run Go and LLGo there.

From source (Linux / macOS, cJSON 1.7.19)

With Git, CMake, a C compiler, a build tool such as Make, and pkg-config installed, build the upstream v1.7.19 release:

git clone --depth 1 --branch v1.7.19 https://github.com/DaveGamble/cJSON.git cJSON-1.7.19
cmake -S cJSON-1.7.19 -B cJSON-1.7.19/build \
  -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX="$HOME/.local" \
  -DCMAKE_INSTALL_LIBDIR=lib \
  -DBUILD_SHARED_LIBS=ON \
  -DENABLE_CJSON_UTILS=ON \
  -DENABLE_CJSON_TEST=OFF
cmake --build cJSON-1.7.19/build
cmake --install cJSON-1.7.19/build
export PKG_CONFIG_PATH="$HOME/.local/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"

On Linux, also make the shared library available at runtime:

export LD_LIBRARY_PATH="$HOME/.local/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"

Keep these environment variables set in the terminal where you build and run your program, or add them to your shell profile.

Install the Go binding

Verify that pkg-config finds the intended cJSON installation:

pkg-config --modversion libcjson libcjson_utils
pkg-config --libs libcjson_utils

Then, from your Go module directory:

go get github.com/llarhub/cjson

The binding also exposes the JSON Pointer, JSON Patch, and JSON Merge Patch helpers from cJSON_Utils.h; these methods require libcjson_utils at link and runtime.

Usage

Parse JSON and read a string field:

package main

import (
	"github.com/goplus/lib/c"
	"github.com/llarhub/cjson"
)

func main() {
	root := cjson.Parse(c.AllocaCStr(`{"name":"LLGo"}`))
	if root == nil {
		panic("invalid JSON")
	}
	defer root.Delete()

	name := root.ObjectItemCaseSensitive(c.AllocaCStr("name"))
	if name != nil && name.IsString() != 0 {
		println(c.GoString(name.StringValue()))
	}
}

Save the example as main.go and run it with llgo run ..

Use the cJSON Utils API to resolve a JSON Pointer:

package main

import (
	"github.com/goplus/lib/c"
	"github.com/llarhub/cjson"
)

func main() {
	root := cjson.Parse(c.AllocaCStr(`{"user":{"name":"LLGo"}}`))
	if root == nil {
		panic("invalid JSON")
	}
	defer root.Delete()

	name := root.Pointer(c.AllocaCStr("/user/name"))
	if name == nil || name.IsString() == 0 {
		panic("JSON Pointer did not resolve to a string")
	}
	println(c.GoString(name.StringValue()))
}

This prints LLGo. The same package also provides JSON Patch and JSON Merge Patch helpers such as GeneratePatches, ApplyPatches, and MergePatch.

Documentation

Index

Constants

View Source
const Array = 32
View Source
const CIRCULAR_LIMIT = 10000
View Source
const False = 1
View Source
const Invalid = 0
View Source
const IsReference = 256
View Source
const LLGoPackage = "link: $(pkg-config --libs libcjson_utils); -lcjson_utils -lcjson"
View Source
const NESTING_LIMIT = 1000
View Source
const Null = 4
View Source
const Number = 8
View Source
const Object = 64
View Source
const Raw = 128
View Source
const String = 16
View Source
const StringIsConst = 512
View Source
const True = 2
View Source
const VERSION_MAJOR = 1
View Source
const VERSION_MINOR = 7
View Source
const VERSION_PATCH = 19

Variables

This section is empty.

Functions

func Free

func Free(object unsafe.Pointer)

func GetErrorPtr

func GetErrorPtr() *c.Char

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 c.SizeT) unsafe.Pointer

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

func Minify

func Minify(json *c.Char)

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

returns the version of cJSON as a string

Types

type Bool

type Bool = c.Int

type Hooks

type Hooks struct {
	MallocFn func(_llcppg_param1 c.SizeT) unsafe.Pointer
	FreeFn   func(_llcppg_param1 unsafe.Pointer)
}

llgo:type C

func (*Hooks) Init

func (self *Hooks) Init()

Supply malloc, realloc and free functions to cJSON

llgo:link (*Hooks).Init C.cJSON_InitHooks

type JSON

type JSON struct {
	Next        *JSON
	Prev        *JSON
	Child       *JSON
	Type        c.Int
	Valuestring *c.Char
	Valueint    c.Int
	Valuedouble c.Double
	String      *c.Char
}

The cJSON structure:

func CreateArray

func CreateArray() *JSON

func CreateBool

func CreateBool(boolean Bool) *JSON

func CreateDoubleArray

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

func CreateFalse

func CreateFalse() *JSON

func CreateFloatArray

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

func CreateIntArray

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

These utilities create an Array of count items. The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.

func CreateNull

func CreateNull() *JSON

These calls create a cJSON item of the appropriate type.

func CreateNumber

func CreateNumber(num c.Double) *JSON

func CreateObject

func CreateObject() *JSON

func CreateRaw

func CreateRaw(raw *c.Char) *JSON

raw json

func CreateString

func CreateString(string *c.Char) *JSON

func CreateStringArray

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

func CreateStringReference

func CreateStringReference(string *c.Char) *JSON

Create a string where valuestring references a string so it will not be freed by cJSON_Delete

func CreateTrue

func CreateTrue() *JSON

func Parse

func Parse(value *c.Char) *JSON

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. Supply a block of JSON, and this returns a cJSON object you can interrogate.

func ParseWithLength

func ParseWithLength(value *c.Char, buffer_length c.SizeT) *JSON

func ParseWithLengthOpts

func ParseWithLengthOpts(value *c.Char, buffer_length c.SizeT, return_parse_end **c.Char, require_null_terminated Bool) *JSON

func ParseWithOpts

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

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 (*JSON) AddArrayToObject

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

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

func (*JSON) AddBoolToObject

func (self *JSON) AddBoolToObject(name *c.Char, boolean Bool) *JSON

llgo:link (*JSON).AddBoolToObject C.cJSON_AddBoolToObject

func (*JSON) AddFalseToObject

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

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

func (*JSON) AddItemReferenceToArray

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

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 (self *JSON) AddItemReferenceToObject(string *c.Char, item *JSON) Bool

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

func (*JSON) AddItemToArray

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

Append item to the specified array/object.

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

func (*JSON) AddItemToObject

func (self *JSON) AddItemToObject(string *c.Char, item *JSON) Bool

llgo:link (*JSON).AddItemToObject C.cJSON_AddItemToObject

func (*JSON) AddItemToObjectCS

func (self *JSON) AddItemToObjectCS(string *c.Char, item *JSON) Bool

Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object. WARNING: 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 (self *JSON) AddNullToObject(name *c.Char) *JSON

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 (self *JSON) AddNumberToObject(name *c.Char, number c.Double) *JSON

llgo:link (*JSON).AddNumberToObject C.cJSON_AddNumberToObject

func (*JSON) AddObjectToObject

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

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

func (*JSON) AddPatchToArray added in v0.1.1

func (self *JSON) AddPatchToArray(operation *c.Char, path *c.Char, value *JSON)

Utility for generating patch array entries.

llgo:link (*JSON).AddPatchToArray C.cJSONUtils_AddPatchToArray

func (*JSON) AddRawToObject

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

llgo:link (*JSON).AddRawToObject C.cJSON_AddRawToObject

func (*JSON) AddStringToObject

func (self *JSON) AddStringToObject(name *c.Char, string *c.Char) *JSON

llgo:link (*JSON).AddStringToObject C.cJSON_AddStringToObject

func (*JSON) AddTrueToObject

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

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

func (*JSON) ApplyPatches added in v0.1.1

func (self *JSON) ApplyPatches(patches *JSON) c.Int

Returns 0 for success.

llgo:link (*JSON).ApplyPatches C.cJSONUtils_ApplyPatches

func (*JSON) ApplyPatchesCaseSensitive added in v0.1.1

func (self *JSON) ApplyPatchesCaseSensitive(patches *JSON) c.Int

llgo:link (*JSON).ApplyPatchesCaseSensitive C.cJSONUtils_ApplyPatchesCaseSensitive

func (*JSON) ArrayItem

func (self *JSON) ArrayItem(index c.Int) *JSON

Retrieve item number "index" from array "array". Returns NULL if unsuccessful.

llgo:link (*JSON).ArrayItem C.cJSON_GetArrayItem

func (*JSON) ArraySize

func (self *JSON) ArraySize() c.Int

Returns the number of items in an array (or object).

llgo:link (*JSON).ArraySize C.cJSON_GetArraySize

func (*JSON) Compare

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

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. 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) CreateArrayReference

func (self *JSON) CreateArrayReference() *JSON

llgo:link (*JSON).CreateArrayReference C.cJSON_CreateArrayReference

func (*JSON) CreateObjectReference

func (self *JSON) CreateObjectReference() *JSON

Create an object/array that only references it's elements so they will not be freed by cJSON_Delete

llgo:link (*JSON).CreateObjectReference C.cJSON_CreateObjectReference

func (*JSON) Delete

func (self *JSON) Delete()

Delete a cJSON entity and all subentities.

llgo:link (*JSON).Delete C.cJSON_Delete

func (*JSON) DeleteItemFromArray

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

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

func (*JSON) DeleteItemFromObject

func (self *JSON) DeleteItemFromObject(string *c.Char)

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

func (*JSON) DeleteItemFromObjectCaseSensitive

func (self *JSON) DeleteItemFromObjectCaseSensitive(string *c.Char)

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

func (*JSON) DetachItemFromArray

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

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

func (*JSON) DetachItemFromObject

func (self *JSON) DetachItemFromObject(string *c.Char) *JSON

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

func (*JSON) DetachItemFromObjectCaseSensitive

func (self *JSON) DetachItemFromObjectCaseSensitive(string *c.Char) *JSON

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

func (*JSON) DetachItemViaPointer

func (self *JSON) DetachItemViaPointer(item *JSON) *JSON

Remove/Detach items from Arrays/Objects.

llgo:link (*JSON).DetachItemViaPointer C.cJSON_DetachItemViaPointer

func (*JSON) Duplicate

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

Duplicate a cJSON item

llgo:link (*JSON).Duplicate C.cJSON_Duplicate

func (*JSON) FindPointerFromObjectTo added in v0.1.1

func (self *JSON) FindPointerFromObjectTo(target *JSON) *c.Char

Given a root object and a target object, construct a pointer from one to the other.

llgo:link (*JSON).FindPointerFromObjectTo C.cJSONUtils_FindPointerFromObjectTo

func (*JSON) GenerateMergePatch added in v0.1.1

func (self *JSON) GenerateMergePatch(to *JSON) *JSON

generates a patch to move from -> to NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key

llgo:link (*JSON).GenerateMergePatch C.cJSONUtils_GenerateMergePatch

func (*JSON) GenerateMergePatchCaseSensitive added in v0.1.1

func (self *JSON) GenerateMergePatchCaseSensitive(to *JSON) *JSON

llgo:link (*JSON).GenerateMergePatchCaseSensitive C.cJSONUtils_GenerateMergePatchCaseSensitive

func (*JSON) GeneratePatches added in v0.1.1

func (self *JSON) GeneratePatches(to *JSON) *JSON

Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec. NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key

llgo:link (*JSON).GeneratePatches C.cJSONUtils_GeneratePatches

func (*JSON) GeneratePatchesCaseSensitive added in v0.1.1

func (self *JSON) GeneratePatchesCaseSensitive(to *JSON) *JSON

llgo:link (*JSON).GeneratePatchesCaseSensitive C.cJSONUtils_GeneratePatchesCaseSensitive

func (*JSON) HasObjectItem

func (self *JSON) HasObjectItem(string *c.Char) Bool

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

func (*JSON) InsertItemInArray

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

Update array items.

llgo:link (*JSON).InsertItemInArray C.cJSON_InsertItemInArray

func (*JSON) IsArray

func (self *JSON) IsArray() Bool

llgo:link (*JSON).IsArray C.cJSON_IsArray

func (*JSON) IsBool

func (self *JSON) IsBool() Bool

llgo:link (*JSON).IsBool C.cJSON_IsBool

func (*JSON) IsFalse

func (self *JSON) IsFalse() Bool

llgo:link (*JSON).IsFalse C.cJSON_IsFalse

func (*JSON) IsInvalid

func (self *JSON) IsInvalid() Bool

These functions check the type of an item

llgo:link (*JSON).IsInvalid C.cJSON_IsInvalid

func (*JSON) IsNull

func (self *JSON) IsNull() Bool

llgo:link (*JSON).IsNull C.cJSON_IsNull

func (*JSON) IsNumber

func (self *JSON) IsNumber() Bool

llgo:link (*JSON).IsNumber C.cJSON_IsNumber

func (*JSON) IsObject

func (self *JSON) IsObject() Bool

llgo:link (*JSON).IsObject C.cJSON_IsObject

func (*JSON) IsRaw

func (self *JSON) IsRaw() Bool

llgo:link (*JSON).IsRaw C.cJSON_IsRaw

func (*JSON) IsString

func (self *JSON) IsString() Bool

llgo:link (*JSON).IsString C.cJSON_IsString

func (*JSON) IsTrue

func (self *JSON) IsTrue() Bool

llgo:link (*JSON).IsTrue C.cJSON_IsTrue

func (*JSON) MergePatch added in v0.1.1

func (self *JSON) MergePatch(patch *JSON) *JSON

Implement RFC7386 (https://tools.ietf.org/html/rfc7396) JSON Merge Patch spec. target will be modified by patch. return value is new ptr for target.

llgo:link (*JSON).MergePatch C.cJSONUtils_MergePatch

func (*JSON) MergePatchCaseSensitive added in v0.1.1

func (self *JSON) MergePatchCaseSensitive(patch *JSON) *JSON

llgo:link (*JSON).MergePatchCaseSensitive C.cJSONUtils_MergePatchCaseSensitive

func (*JSON) NumberValue

func (self *JSON) NumberValue() c.Double

llgo:link (*JSON).NumberValue C.cJSON_GetNumberValue

func (*JSON) ObjectItem

func (self *JSON) ObjectItem(string *c.Char) *JSON

Get item "string" from object. Case insensitive.

llgo:link (*JSON).ObjectItem C.cJSON_GetObjectItem

func (*JSON) ObjectItemCaseSensitive

func (self *JSON) ObjectItemCaseSensitive(string *c.Char) *JSON

llgo:link (*JSON).ObjectItemCaseSensitive C.cJSON_GetObjectItemCaseSensitive

func (*JSON) Pointer added in v0.1.1

func (self *JSON) Pointer(pointer *c.Char) *JSON

Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec.

llgo:link (*JSON).Pointer C.cJSONUtils_GetPointer

func (*JSON) PointerCaseSensitive added in v0.1.1

func (self *JSON) PointerCaseSensitive(pointer *c.Char) *JSON

llgo:link (*JSON).PointerCaseSensitive C.cJSONUtils_GetPointerCaseSensitive

func (*JSON) Print

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

Render a cJSON entity to text for transfer/storage.

llgo:link (*JSON).Print C.cJSON_Print

func (*JSON) PrintBuffered

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

Render a cJSON 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 (self *JSON) PrintPreallocated(buffer *c.Char, length c.Int, format Bool) Bool

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: 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 (self *JSON) PrintUnformatted() *c.Char

Render a cJSON entity to text for transfer/storage without any formatting.

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

func (*JSON) ReplaceItemInArray

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

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

func (*JSON) ReplaceItemInObject

func (self *JSON) ReplaceItemInObject(string *c.Char, newitem *JSON) Bool

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

func (*JSON) ReplaceItemInObjectCaseSensitive

func (self *JSON) ReplaceItemInObjectCaseSensitive(string *c.Char, newitem *JSON) Bool

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

func (*JSON) ReplaceItemViaPointer

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

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

func (*JSON) SetNumberHelper

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

helper for the cJSON_SetNumberValue macro

llgo:link (*JSON).SetNumberHelper C.cJSON_SetNumberHelper

func (*JSON) SetValuestring

func (self *JSON) SetValuestring(valuestring *c.Char) *c.Char

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

func (*JSON) SortObject added in v0.1.1

func (self *JSON) SortObject()

Sorts the members of the object into alphabetical order.

llgo:link (*JSON).SortObject C.cJSONUtils_SortObject

func (*JSON) SortObjectCaseSensitive added in v0.1.1

func (self *JSON) SortObjectCaseSensitive()

llgo:link (*JSON).SortObjectCaseSensitive C.cJSONUtils_SortObjectCaseSensitive

func (*JSON) StringValue

func (self *JSON) StringValue() *c.Char

Check item type and return its value

llgo:link (*JSON).StringValue C.cJSON_GetStringValue

Jump to

Keyboard shortcuts

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