Я новичок в JSON
1. я получил результат json в формате html в следующем формате
JSon Result
Alert(result)
{"resort0":"Abaco Beach Resort at Boat Harbour","resort1":"Alexandra Resort","room0":"1 Bedroom Luxury Oceanfront Suite","room1":"2 Bedroom Deluxe Ocean View Suite","room2":"Deluxe Garden View Studio","room3":"Deluxe Ocean View Studio","room4":"Deluxe Oceanfront","room5":"Oceanfront","room6":"Superior Oceanfront"}
alert(result.resort1); // alert "undefined"
alert(result.resort0); // alert "undefined"
2
, Как я могу получить такой формат с Java-кодом JSONObject
Resorts является ключом карты?
{
"Resorts" : [
{ "name" : "Resort1", // First element
"room1" : "rooms1"
"room2" : "rooms2" },
{ "name" : "Resort2", // Second element
"room1" : "rooms1",
"room2" : "rooms2", }
]
}