added JSON query
implemented JSON request ordered by distance