Click here to Skip to main content
16,017,037 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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

HTML
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"}]}]}

C#
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"},{"Acco‌​modationTypeName":"2bhk","available_rooms":"6"}]},{"propertyId":"BHARAT tourist","cell":[{"AccomodationTypeName":"VILLA","available_rooms":"2"},{"Accomo‌​dationTypeName":"2bhk","available_rooms":"3"}]},{"propertyId":"sneh tourist hotel","cell":[{"AccomodationTypeName":"2hk room","available_rooms":"1"}]}]}
Posted

1 solution

You need to fix your server side code that is providing JSON.
Share your code may be I can help you to fix it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900