if @zones
  json.array! @zones do |zone|
    if zone.is_active
      json.id zone.id
      json.name zone.name
      #List all tables
      json.tables zone.tables do |table|
        if table.is_active
          json.id table.id
          json.name table.name
          json.status table.status
          json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
          json.current_booking table.get_current_booking.booking_id rescue ""
        end
      end

      json.rooms zone.rooms do |room|
        if room.is_active
          json.id room.id
          json.name room.name
          json.status room.status
          json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
          json.current_booking room.get_current_booking.booking_id rescue ""
        end
      end
    end
  end
else #list all tables and rooms with out zones
  json.tables @all_tables do |table|
    if table.is_active
      json.id table.id
      json.name table.name
      json.status table.status
      json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
      json.current_booking table.get_current_booking.booking_id rescue ""
    end
  end

  json.rooms @all_rooms do |room|
    if room.is_active
      json.id room.id
      json.name room.name
      json.status room.status
      json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
      json.current_booking room.get_current_booking.booking_id rescue ""
    end
  end
end
