How to bind Json Response into dynamic structure or Entity


I have created rest web service and in response it can be json format of any entity like Employee,User etc so how can bind json into particular entity or structure.

Thanks & Regards

Mithlesh Singh

Hi Mithlesh,

You can use the JSONDeserialize tool in any action. The action receives the JSON and the data type that represents the structure of data in the JSON (can be a Structure, Entity, Record or List).

Although Jorge's answer is a solution to your question, creating REST services that have a variable JSON response is in general considered to be (very) bad practice.

Hi Mithlesh,

Actually, now that I read it again, I realize you need to serialize data into JSON, not the other way around... the tool you can use for that is the JSON Serialize, that only receives the data (any variable of Structure, Entity, Record or Record List data types) to be serialized.

That being said, I to agree with Kilian, as a best practice you should rely on the platform to handle any required JSON serialization/deserialization for Output and Input Parameters defined on your exposed REST service methods