set Property name
hi
we have a rest API that that on of the JSON object contain Property name "verify.facePosition"
we try to translate the JSON file to object with the function ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject()
how can we define the Property to "verify.facePosition" As %Boolean in the class ?
i know that with underscore i can define the property with quotation marks like this - Property "verify_facePosition" As %Boolean
thanks for the help
Comments
Can you share the code of your class or an example to us?
Ok, using Rest Api I'm posting a request and getting an answer According to the data I posted. for example the request body looks like that:
{
"details":{
"id":"123456789",
"firstName":"bob",
"lastName":"bond",
}
}
The class Properties looks like that:
Property id As %Integer [ Required ];
Property firstName As %String [ Required ];
Property lastName As %String [ Required ];
And in the response I'm getting the details about this client. So far so good.
So now I need to send the request body like that:
{
"details":{
" client.id":"123456789",
"client.firstName":"bob",
"client.lastName":"bond",
}
}
And I can't write properties with a dot:
Property client.id As %Integer [ Required ];
Property client.firstName As %String [ Required ];
Property client. lastName As %String [ Required ];
How can I fix this?
try this dirty hack:
- create your JSON object using "_"
- Property "client._id" As %Integer [ Required ];
- Property "client_firstName" As %String [ Required ];
- Property "client_lastName" As %String [ Required ];
- create your JSON_body = { "details":{ ....} }
- before sending use $TRanslate(JSON_body,"_",".")
In IRIS you can define the name of the property when the object is transformed into a JSON:
https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic…
In your case I suggest you to follow the idea of @Robert Cemper ...and update your Cache as soon as possible!