Need to convert below request format by using javascript to output format.
Request:
{
"patientId": "1234",
"patientName": "Sai",
"patientFname": "Kumar",
"patientLname": "Gadi",
"city": "",
"zipcode":null,
"state":" "
}
Need to convert as below format but we need to check object keyvalue of the element should not be null or " "(no space) or ""(not empty) then only we need to print the object name and its values as below format:
Output:
[
{
"propertyName": "patientId",
"propertyValue": "1234"
},
{
"propertyName": "patientName",
"propertyValue": "Sai"
},
{
"propertyName": "patientFname",
"propertyValue": "Kumar"
},
{
"propertyName": "patientLname",
"propertyValue": "Gadi"
}
]
Thanks in advance.