jsonGetObjectKey

Category: JSON

Syntax:

jsonGetObjectKey:String(json:String, key:String, index:Int)


Parameters

Returns

String



Summary

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.

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.

View detailed documentation online



Example
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