I have few questions in server side.
I have more than 50 API.
Need to check every API (GET,POST) method the following things.
- Validate the input is valid json.
- Input data need to check the some of the key name with data.
For example 1:
{
"name": "<city name1>",
"status": 1,
"id" : 3,
"code" : 5,
"abcd" : "44",
---------------
------------
}
In this above Input I need to check few key are mantory. eg: name, code
Example 2:
{
"country": [
{
"state": [
{
"name": "<city name1>",
"status": 1
}, {
"name": "<city name2>",
"status": 2
}, {
"name": "<city name3>",
"status": 3
}
],
"name": "<state Name1>"
}, {
"state": [
{
"name": "<city name1>",
"status": 1
}, {
"name": "<city name2>",
"status": 2
}, {
"name": "<city name3>",
"status": 3
}
],
"name": "<state Name2>"
}
]
}
In above example I need to check the state and city > name is mandatory.
I checked the packages but not get suitable one for me.
Have any packages for check the json validation?