Model to string

Models Pure
Model to string
Model(model)
Result
Format(Data format) JSON
Pretty false

Description

Pure function that serialises a model to a string. Supports JSON, YAML, and XML formats. Enable pretty for indented output. Useful for debugging — pipe the result into Log message.

When to use

Use Model to string whenever you need a model value as text — for logging, for building an HTTP request body from a string, or for storing a serialised snapshot. It is the quickest way to inspect what a model actually contains: wire it into Log message with Pretty enabled and the full structure appears in the execution log.

Pick the Format to match the consumer. JSON is the common default; choose YAML or XML when an external system expects those. For streaming a model straight into an HTTP request body without buffering it as a string first, use Model to stream instead.

See the Models tutorial for a full worked example.

Pins

Input pins

Pin Type Default Notes
Model model The model value to serialise. Wire from a Make node, a Parse to model node, or any output that produces a model.
Format Data format JSON The serialisation format: JSON, YAML, or XML.
Pretty boolean false When true, produces human-readable indented output. Leave false for compact output.

Output pins

Pin Type Notes
Result string The serialised model as a string in the selected format.

Example

Debug a model assembled earlier in the pipeline. Wire the model output into the Model input of Model to string, set Format to JSON and Pretty to true, then wire the Result output into the Message input of Log message. The indented JSON is written to the execution log so you can verify every field before the pipeline continues.

See also