Sample code for 30+ languages & platforms
Visual FoxPro

JSON PathPrefix Example

Demonstrates the JSON object's PathPrefix property.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loJson
LOCAL lcCity

lnSuccess = 0

loJson = CreateObject('Chilkat.JsonObject')

loJson.PathPrefix = "company.billing."

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

loJson.EmitCompact = 0

? loJson.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"
*     }
*   }
* }

lcCity = loJson.StringOf("city")
? "city = " + lcCity

RELEASE loJson