(Lianja) JSON PathPrefix Example
Demonstrates the JSON object's PathPrefix property.
llSuccess = .F.
loJson = createobject("CkJsonObject")
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 = .F.
? 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"
// }
// }
// }
release loJson
|