code: public void toJson(JsonWriter jsonWriter, boolean keepConfig)
        throws IOException {
      jsonWriter.beginObject();
      writeStateSummary(jsonWriter);
  
      jsonWriter.name("task states");
      jsonWriter.beginArray();
      for (TaskState taskState : this.taskStates.values()) {
        taskState.toJson(jsonWriter, keepConfig);
      }
      for (TaskState taskState : this.skippedTaskStates.values()) {
        taskState.toJson(jsonWriter, keepConfig);
      }
      jsonWriter.endArray();
  
      if (keepConfig) {
        jsonWriter.name("properties");
        propsToJson(jsonWriter);
      }
  
      jsonWriter.endObject();
    }
docs: Convert this {@link JobState} to a json document.
  
  @param jsonWriter a {@link com.google.gson.stream.JsonWriter}
  used to write the json document
  @param keepConfig whether to keep all configuration properties
  @throws IOException