jsonReadObject

Category: JSON

Syntax:

jsonReadObject:String(json:String, key:String)


Parameters

Returns

String



Summary

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 ("{...}"), or "" if there's no such field or its value isn't an object.

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}}
Local addr:String = jsonReadObject(j, "address")
Print jsonReadString(addr, "city")   ; Berlin
Print jsonReadInt(addr, "zip")       ; 10115

BambooBasic © 2026 Michael Denathorn