protected function addEchoToJsonResponse(JsonResponse $r) {

		// handle JSON encoded request data
		
		if($this->isXhr && $this->xhrBag && $this->xhrBag->get('echo') == 1) {

			// echo is the original xmlHttpRequest sans echo property

			$echo = json_decode($this->xhrBag->get('xmlHttpRequest'));
			unset($echo->echo);

		}
		
		// handle plain POST or GET data
		
		else {

			if($this->request->getMethod() === 'POST' && $this->request->request->get('echo')) {
				$echo = $this->request->request->all();
				unset($echo['echo']);
			}

			else if($this->request->query->get('echo')) {
				$echo = $this->request->query->all();
				unset($echo['echo']);
			}

		}

		if(isset($echo)) {
			$r->setPayload([
				'echo'		=> $echo,
				'response'	=> json_decode($r->getContent())
			]);
		}
		
		return $r;

	}