Sample code for 30+ languages & platforms
Xojo Plugin

JSON PathPrefix Example

Demonstrates the JSON object's PathPrefix property.

Chilkat Xojo Plugin Downloads

Xojo Plugin
Dim success As Boolean
success = False

Dim json As New Chilkat.JsonObject

json.PathPrefix = "company.billing."

success = json.UpdateString("company_name","TechNova Solutions Inc.")
success = json.UpdateString("address_line_1","123 Innovation Drive")
success = json.UpdateString("address_line_2","Suite 450")
success = json.UpdateString("city","Seattle")
success = json.UpdateString("state_province","WA")
success = json.UpdateString("postal_code","98101")
success = json.UpdateString("country","USA")

json.EmitCompact = False

System.DebugLog(json.Emit())

// Result:

// {
//   "company": {
//     "billing": {
//       "company_name": "TechNova Solutions Inc.",
//       "address_line_1": "123 Innovation Drive",
//       "address_line_2": "Suite 450",
//       "city": "Seattle",
//       "state_province": "WA",
//       "postal_code": "98101",
//       "country": "USA"
//     }
//   }
// }

Dim city As String
city = json.StringOf("city")
System.DebugLog("city = " + city)