I am developing on-line property booking site for tourist here is my table as where i am retriving data from database as
PROPERTYiD ACCOMODATIONTYPE AVAILABLEROOMS
-----------------------------------------------
| |
kalyan appartment | 1BHK | 5
kalyan appartment | 2 BHK | 6
BHARAT tourist | VILLA | 2
BHARAT tourist | 2 BHK | 3
sneh tourist hotel | 2hk room | 1
My json is
{"rows":[{"propertyId":"kalyan appartment","cell":[{"available_rooms":"5","AccomodationTypeName":"1bhk"}]},{"propertyId":"kalyan appartment","cell":[{"available_rooms":"6","AccomodationTypeName":"2bhk"}]},{"propertyId":"BHARAT tourist","cell":[{"available_rooms":"2","AccomodationTypeName":"villa"}]},{"propertyId":"BHARAT tourist","cell":[{"available_rooms":"3","AccomodationTypeName":"2bhk"}]},{"propertyId":"sneh tourist hotel","cell":[{"available_rooms":"1","AccomodationTypeName":"2hk room"}]}]}
Here my json is displying available rooms per accommodation type but i want my json should be (no of accomodation & their available rooms per property id )means it should give json as-
{"rows":[{"propertyId":"kalyan appartment","cell":[{"AccomodationTypeName":"1bhk","available_rooms":"5"},{"AccomodationTypeName":"2bhk","available_rooms":"6"}]},{"propertyId":"BHARAT tourist","cell":[{"AccomodationTypeName":"VILLA","available_rooms":"2"},{"AccomodationTypeName":"2bhk","available_rooms":"3"}]},{"propertyId":"sneh tourist hotel","cell":[{"AccomodationTypeName":"2hk room","available_rooms":"1"}]}]}