as below json shows the request giving to API,i need to validate this json as each fields should present if not i have to give the response back as the attribute names (for ex: if "name" and "age" fields are missing i have to give response as {"error": "name ,age filds are missing "} )
please help me
{
"name":"samsa",
"age":21,
"address":"xyz",
"pincode":51342
}
Hi Santhu,
If this these are record values that you receive, you can just check in the record if these fields are empty. Otherwise you can deserialize the JSON to a record and check the values that way.
Regards,
Lennart
santhu MS wrote:
You can use JSONDeserialize to parse the JSON string and check for the validity of as many fields and send a error response back to the consumer with error message.
something like below..
Sridhar. S
Isn't this a duplicate of this one?
Yes it is. I'm closing this one.