I have this json object. Json key remarks
and address
is empty. If its empty then json prints undefine
when extracting json. But i want replace empty json with -
sign. I know I can use:
if(msg.hasOwnProperty('remarks')== ""){
alert("A");
}
But how to loop through all the keys and check if its empty and replace with -
rather than checking it individually.
[
{
"id": "224",
"booking_id": "1",
"room_type": null,
"no_of_rooms_booked": null,
"check_in_date": "2014-12-23",
"check_out_date": "2014-12-24",
"room_id": "93",
"hotel_id": "9",
"status": "1",
"user_id": "15",
"payment_type": "",
"payment_status": "",
"hotelname": "sample hotel",
"hoteladdress": "sample address",
"hotelcontact": "056533977",
"Id": "224",
"full_name": "Hom Nath Bagale",
"address": "",
"occupation": "Student",
"nationality": "Nepali",
"contact_no": "9845214140",
"email": "bhomnath@salyani.com.np",
"remarks": "",
"total_amount": "5000",
"child": "0",
"adult": "1",
"verification_code": null,
"roomname": "sample room2",
"roomprice": "1.5",
"roomdescription": "this is for demo",
"roomimage": "2.jpg"
}]