Skip to main content

Writing JSON

The JSON datatype supports writing JSON to Strings or Writers.

Writing to a String:​

import static org.operaton.spin.Spin.JSON;

SpinJsonNode jsonNode = JSON("{\"customer\": \"Kermit\"}");

String json = jsonNode.toString();

Writing to a Writer​

import static org.operaton.spin.Spin.JSON;

SpinJsonNode jsonNode = JSON("{\"customer\": \"Kermit\"}");

StringWriter writer = jsonNode.writeToWriter(new StringWriter());