The JSON datatype supports writing JSON to Strings or Writers.

Writing to a String:

  1. import static org.camunda.spin.Spin.JSON;
  2. SpinJsonNode jsonNode = JSON("{\"customer\": \"Kermit\"}");
  3. String json = jsonNode.toString();

Writing to a Writer

  1. import static org.camunda.spin.Spin.JSON;
  2. SpinJsonNode jsonNode = JSON("{\"customer\": \"Kermit\"}");
  3. StringWriter writer = jsonNode.writeToWriter(new StringWriter());

原文: https://docs.camunda.org/manual/7.9/reference/spin/json/02-writing-json/