V2

Convert

Converts values between UTF-8 strings, streams, and JSON arrays.

Use this Node when you need to change a value into the format expected by another Node. This is especially useful when one Node returns text and the next Node expects a stream, or when you need to split a JSON array into Flowgear array items.

Version History

0.0.0.1 - Current release.

Setup Notes

You can add this Node to a Workflow without authentication or external setup.

This is a processor Node. It runs inside your Workflow and does not connect to an external system.

Methods

This Node provides four methods. Choose the method that matches the format you have and the format you need next in your Workflow.

StringToStream

Converts a string value into a UTF-8 stream.

Use this method before passing text to a Node that expects stream or file content.

Parameter Type Description
String String The text value to convert into a stream.
Return Type Description
Stream Stream The UTF-8 encoded stream created from the input string.

StreamToString

Reads a stream as UTF-8 text and returns the result as a string.

Use this method when an earlier Node returns stream content and you want to inspect it, transform it, or pass it to a Node that expects text.

This method reads from the stream's current position. If another Node has already read part of the stream, the returned string may contain only the remaining content.

Parameter Type Description
Stream Stream The stream to read as UTF-8 text.
Return Type Description
String String The decoded UTF-8 text from the stream.

JsonStringToArray

Parses a JSON array string and returns each item as an array value.

Use this method when you receive JSON text such as [{...},{...}] and want to process the items individually in a For Each Node or another array-aware Step.

The input must be a valid JSON array. This method does not accept a single JSON object or other JSON value types.

If the input string is empty or null, this method returns no items.

Parameter Type Description
String String A valid JSON array string.
Return Type Description
Array Array The items parsed from the JSON array string.

ArrayToJsonString

Builds a JSON array string from an input array.

Use this method when you have array items in your Workflow and need to send them to a Node or endpoint that expects JSON text.

If the input array is null, this method returns null.

Parameter Type Description
Array Array The array to serialize as a JSON array string.
Return Type Description
String String The JSON array string created from the input array.

Usage Notes

  • All string and stream conversions in this Node use UTF-8.
  • Use ArrayToJsonString and JsonStringToArray to move between JSON text and Flowgear array handling without writing custom scripting.

Examples

Convert a request body from text to a stream

If you build a request body as text in a previous Step, use StringToStream before passing it to a Node that expects stream content.

Split a JSON array into individual items

If a Node returns a string such as:

[{"id":1},{"id":2},{"id":3}]

Use JsonStringToArray to turn that string into array items, then pass the result to a For Each Node to process each item separately.

Build JSON text from array data

If your Workflow produces array items that you need to send to an HTTP endpoint, use ArrayToJsonString to serialize the array before passing it to a request Node.

See Also