Category: JSON
Syntax:
jsonReadObject:String(json:String, key:String)
String
Gets an object that's the value of a field, such as one written with jsonBeginObjectField.
Takes the JSON text and the field's name.
Returns the object as JSON text ("{...}"), ready for jsonReadString, jsonReadInt and the other readers, or "" if there's no such field or its value isn't an object. Use it when two objects have fields with the same name: the readers on their own take the first one they find.
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}}
Local addr:String = jsonReadObject(j, "address")
Print jsonReadString(addr, "city") ; Berlin
Print jsonReadInt(addr, "zip") ; 10115
BambooBasic © 2026 Michael Denathorn