code: function json (request) {
  
      var type = request.headers.get('Content-Type') || '';
  
      if (isObject(request.body) && type.indexOf('application/json') === 0) {
          request.body = JSON.stringify(request.body);
      }
  
      return function (response) {
  
          return response.bodyText ? when(response.text(), function (text) {
  
              var type = response.headers.get('Content-Type') || '';
  
              if (type.indexOf('application/json') === 0 || isJson(text)) {
  
                  try {
                      response.body = JSON.parse(text);
                  } catch (e) {
                      response.body = null;
                  }
  
              } else {
                  response.body = text;
              }
  
              return response;
  
          }) : response;
  
      };
  }
docs: JSON Interceptor.