The JSON datatype supports writing JSON to Strings or Writers.
Writing to a String:
import static org.camunda.spin.Spin.JSON;
SpinJsonNode jsonNode = JSON("{\"customer\": \"Kermit\"}");
String json = jsonNode.toString();
Writing to a Writer
import static org.camunda.spin.Spin.JSON;
SpinJsonNode jsonNode = JSON("{\"customer\": \"Kermit\"}");
StringWriter writer = jsonNode.writeToWriter(new StringWriter());
原文: https://docs.camunda.org/manual/7.9/reference/spin/json/02-writing-json/