JSON Document

Parse JSON documents into JSON items, or create JSON documents from JSON items.

Revision History

0.0.0.4 - Initial release.
0.0.0.11 - Version update.
0.2.0.14 - Added separate methods for JSON arrays and JSON objects.

Setup Notes

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

Methods

ParseAsArray

Reads a JSON document that contains a root JSON array and returns each object in the array.

Use AllowTrailingCommas only when the source document is known to include trailing commas.

Parameter Type Description
Document Stream The JSON document to parse.
Options.PropertyNameCaseInsensitive Boolean Treat property names case-insensitively while parsing. The default is true.
Options.AllowTrailingCommas Boolean Allow trailing commas in arrays and objects. The default is false.
Options.MaxDepth Integer Maximum nesting depth to allow while parsing. Use 0 for the framework default.
Return Type Description
Items Array One JSON object for each parsed item.

ParseAsObject

Reads a JSON document that contains a root JSON object and returns that object.

Use AllowTrailingCommas only when the source document is known to include trailing commas.

Parameter Type Description
Document Stream The JSON document to parse.
Options.PropertyNameCaseInsensitive Boolean Treat property names case-insensitively while parsing. The default is true.
Options.AllowTrailingCommas Boolean Allow trailing commas in arrays and objects. The default is false.
Options.MaxDepth Integer Maximum nesting depth to allow while parsing. Use 0 for the framework default.
Return Type Description
Object Object The parsed root JSON object.

CreateFromArray

Writes input items into one root JSON array document.

If Items is empty, the output document contains an empty array.

Parameter Type Description
Items Array The JSON items to include in the output document.
Return Type Description
Document Stream The rendered JSON document.

CreateFromObject

Writes one JSON object as a root JSON object document.

Use this method when the output document must contain a single root object instead of an array.

Parameter Type Description
Object Object The JSON object to write to the document.
Return Type Description
Document Stream The rendered JSON document.

Usage Notes

  • Leading whitespace and a UTF-8 byte order mark are ignored when the document is parsed.
  • ParseAsArray requires the document to start with [.
  • ParseAsObject requires the document to start with {.
  • Use CreateFromArray when you need a JSON array document.
  • Use CreateFromObject when you need a single root JSON object document.

Known Issues

  • ParseAsArray expects array items to be JSON objects. Arrays that contain non-object values are currently not supported.