code: public String toJSON(RecordedQuery query) {
  		StringWriter sw = new StringWriter();
  		JsonGenerator generator;
  		if (this.prettyFormat != Format.NONE) {
  			JsonGeneratorFactory gf = JSONWriter.getPrettyGeneratorFactory();
  			generator = gf.createGenerator(sw);
  		} else
  			generator = Json.createGenerator(sw);
  		
  		generator.writeStartObject();
  		writeQuery(query, generator);
  		generator.writeEnd();
  
  		generator.flush();
  		return sw.toString();
  	}
docs: Answer a JSON representation of a recorded query
  @param query
  @return