code: private void compilePlanToJSON(List<DumpableNode<?>> nodes, PrintWriter writer) {
  		// initialization to assign node ids
  		this.nodeIds = new HashMap<DumpableNode<?>, Integer>();
  		this.nodeCnt = 0;
  		
  		// JSON header
  		writer.print("{\n\t\"nodes\": [\n\n");
  
  		// Generate JSON for plan
  		for (int i = 0; i < nodes.size(); i++) {
  			visit(nodes.get(i), writer, i == 0);
  		}
  		
  		// JSON Footer
  		writer.println("\n\t]\n}");
  	}
docs: --------------------------------------------------------------------------------------------