Category: JSON
Syntax:
jsonGetObjectKey:String(json:String, key:String, index:Int)
String
Gets the name of one field of an object that's the value of a field.
Takes the JSON text, the field's name and the index of the field you want, from 0 to jsonGetObjectCount - 1, in the order they're written.
Returns the field's name, or "" if there's no such field, its value isn't an object, or the index is out of range. Read the field's value with jsonReadString, jsonReadInt and so on, from the object jsonReadObject gives you.
An empty key ("") means json itself is the object, so this also works on an object from jsonGetArrayElement or jsonReadObject.
View detailed documentation online
Local j:String = jsonBegin()
j = jsonWriteString(j, "name", "Mike")
j = jsonBeginObjectField(j, "address")
j = jsonWriteString(j, "city", "Berlin")
j = jsonWriteInt(j, "zip", 10115)
j = jsonEndObject(j)
j = jsonEnd(j)
; {"name":"Mike","address":{"city":"Berlin","zip":10115}}
Print jsonGetObjectKey(j, "address", 0) ; city
Print jsonGetObjectKey(j, "address", 1) ; zip
Print jsonGetObjectKey(j, "", 1) ; address
BambooBasic © 2026 Michael Denathorn