code: public void write(JsonGenerator jsonGenerator) throws IOException {
      jsonGenerator.writeStartObject();
  
      // clusterNodeInfo begins
      jsonGenerator.writeFieldName("clusterNodeInfo");
      jsonGenerator.writeStartObject();
      jsonGenerator.writeStringField("name", clusterNodeInfo.name);
      jsonGenerator.writeObjectField("address", clusterNodeInfo.address);
      jsonGenerator.writeObjectField("total", clusterNodeInfo.total);
      jsonGenerator.writeObjectField("free", clusterNodeInfo.free);
      jsonGenerator.writeObjectField("resourceInfos",
        clusterNodeInfo.resourceInfos);
      jsonGenerator.writeEndObject();
      // clusterNodeInfo ends
  
      // grants begins
      jsonGenerator.writeFieldName("grants");
      jsonGenerator.writeStartObject();
      for (Map.Entry<GrantId, ResourceRequestInfo> entry : grants.entrySet()) {
        jsonGenerator.writeFieldName(entry.getKey().unique);
        jsonGenerator.writeStartObject();
        jsonGenerator.writeFieldName("grantId");
        entry.getKey().write(jsonGenerator);
        jsonGenerator.writeFieldName("grant");
        entry.getValue().write(jsonGenerator);
        jsonGenerator.writeEndObject();
      }
      jsonGenerator.writeEndObject();
      // grants ends
  
      jsonGenerator.writeEndObject();
      // We skip the hostNode and lastHeartbeatTime as they need not be persisted.
      // resourceTypeToMaxCpu and resourceTypeToStatsMap can be rebuilt using the
      // conf and the grants respectively.
    }
docs: Used to write the state of the ClusterNode instance to disk, when we are
  persisting the state of the NodeManager
  @param jsonGenerator The JsonGenerator instance being used to write JSON
  to disk
  @throws IOException