📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

Object Functions



This section provides reference information for object functions in TiDB Cloud Lake. Object functions enable creation, manipulation, and extraction of information from JSON object data structures.

Object Construction

FunctionDescriptionExample
OBJECT_CONSTRUCTCreates a JSON object from key-value pairsOBJECT_CONSTRUCT('name', 'John', 'age', 30){"name":"John","age":30}
OBJECT_CONSTRUCT_KEEP_NULLCreates a JSON object keeping null valuesOBJECT_CONSTRUCT_KEEP_NULL('a', 1, 'b', null){"a":1,"b":null}

Object Information

FunctionDescriptionExample
OBJECT_KEYSReturns all keys from a JSON object as an arrayOBJECT_KEYS({"name":"John","age":30})["name","age"]

Object Modification

FunctionDescriptionExample
OBJECT_INSERTInserts or updates a key-value pair in a JSON objectOBJECT_INSERT({"name":"John"}, "age", 30){"name":"John","age":30}
OBJECT_DELETERemoves a key-value pair from a JSON objectOBJECT_DELETE({"name":"John","age":30}, "age"){"name":"John"}

Object Selection

FunctionDescriptionExample
OBJECT_PICKCreates a new object with only specified keysOBJECT_PICK({"a":1,"b":2,"c":3}, ["a","c"]){"a":1,"c":3}

Was this page helpful?