Message

_images/Message_54.png

Parse JSON data in segmentation and use them to control other widgets.

Signals

Inputs:

  • Segmentation

    Segmentation containing a single segment with the JSON data to be parsed

Outputs:

  • Message

    JSONMessage object that can be sent to other widgets

Description

This widget inputs a segmentation containing a single segment whose content is in JSON format. After validation, the data are converted to a JSONMessage object and emitted to the widget’s output connections. Provided that the data conform to one of the formats described in section JSON im-/export format, the JSONMessage object can be sent to an instance of the corresponding widget (either Text Files, URLs, Recode, or Segment) and used to control its behavior remotely.

Interface of the Message widget

Figure 1: Interface of the Message widget.

The widget’s interface offers no user-controlled option (see figure 1 above).

The Send button triggers the emission of a JSONMessage object to the output connection(s). When it is selected, the Send automatically checkbox disables the button and the widget attempts to automatically emit a segmentation when its input data are modified (by deletion or addition of a connection, or because modified data is received through an existing connection).

The informations generated below the Send button indicate the number of items present in the parsed JSON data, or the reasons why no JSONObject can be emitted (no input or invalid data, input segmentation containing more than one segment).

Messages

Information

Data correctly sent to output: <n> items.
This confirms that the widget has operated properly.
Settings were (or Input has) changed, please click ‘Send’ when ready.
Settings and/or input have changed but the Send automatically checkbox has not been selected, so the user is prompted to click the Send button (or equivalently check the box) in order for computation and data emission to proceed.
No data sent to output yet: no input segmentation.
The widget instance is not able to emit data to output because it receives none on its input channel(s).
No data sent to output yet, see ‘Widget state’ below.
A problem with the instance’s parameters and/or input data prevents it from operating properly, and additional diagnostic information can be found in the Widget state box at the bottom of the instance’s interface (see Warnings and Errors below).

Warnings

Input segmentation contains more than 1 segment.
The input segmentation must contain exactly 1 segment.

Errors

JSON parsing error.
The input JSON data couldn’t be correctly parsed. Please use a JSON validator to check the data’s well-formedness.