Converts any HARK supported data type to JSON text of the string type.
No files are required.
When to use
This node is used to connect to a node (eg HarkDataStreamSender or HARK-Python’s PyCodeExecuter ) that can accept input of string type. This node can convert any type supported by HARK as JSON text so, it can be handled easily when using it with JSON text understandable languages (eg Python, JavaScript etc). For example, in HARK-Python’s PyCodeExecuter node, you can easily convert to Python object by using 'import json' and 'json.load()' in your script which processes data received with string type. Note that although the output of many nodes existing in HARK can be used as an input for this node, exception cases exists. This will be improved with future updates.
Typical connection
Figure 6.139 and 6.140 shows connection examples for the TextConverter .
The sample network in Figure 6.139 is a network that transmits the sound source localization result and separated sound using the HarkDataStreamSender node. node_HarkDataStreamSender_2 is a connection example in the case where the information being transmitted on node_HarkDataStreamSender_1 is transmitted after converting it to JSON text with the TextConverter node.
The sample network in Figure 6.140 is a network used to send the sound source localization result and separated sound to the HARK-Python’s PyCodeExecuter node.
Input
: any type. For the currently supported types, see the table 6.138. Any number of input terminals can be added. The name of the input terminal is used as the name of the output JSON object (key in map, hash, associative array etc).
Output
: string type.
Parameter
Parameter name |
Type |
Default value |
Unit |
Description |
ENABLE_DEBUG |
false |
Select whether to output the converted JSON text to standard output. |
: bool type. The default value is false. Setting the value to true outputs the converted JSON text to the standard output.
INPUT |
OUTPUT |
input object type |
output object type |
input example |
output result |
$ true $ |
{'DATA': true} |
$ - $ |
{'DATA': true} |
$ - $ |
{'DATA': false} |
$ 1 $ |
{'DATA': 1} |
$ 1 $ |
{'DATA': 1} |
$ 1.1 $ |
{'DATA': 1.1} |
$ 1.1 $ |
{'DATA': 1.1} |
$ 1.1 - 2.2i $ |
{'DATA': (1.1, -2.2)} |
$ \left\langle \begin{array}{cccccc} 1 & -2 & 3 & -4 & 5 & -6 \end{array} \right\rangle $ |
{'DATA': [1, -2, 3, -4, 5, -6]} |
$ \left\langle \begin{array}{cccccc} 1.1 & -2.2 & 3.3 & -4.4 & 5.5 & -6.6 \end{array} \right\rangle $ |
{'DATA': [1.1, -2.2, 3.3, -4.4, 5.5, -6.6]} |
$ \left\langle \begin{array}{cccccc} 1.1 - 2.2i & 3.3 + 4.4i & -5.5 - 6.6i \end{array} \right\rangle $ |
{'DATA': [(1.1, -2.2), (3.3, 4.4), (-5.5, -6.6)]} |
$ \left[ \begin{array}{cc} 1 & -2\\ -3 & 4\\ 5 & 6\\ \end{array} \right] $ |
{'DATA': [[1, -2], [-3, 4], [5, 6]]} |
$ \left[ \begin{array}{cc} 1.1 & -2.2\\ -3.3 & 4.4\\ 5.5 & 6.6\\ \end{array} \right] $ |
{'DATA': [[1.1, -2.2], [-3.3, 4.4], [5.5, 6.6]]} |
$ \left[ \begin{array}{cc} 1.1 - 2.2i & 3.3 + 4.4i\\ -5.5 + 6.6i & -7.7 - 8.8i\\ \end{array} \right] $ |
{'DATA': [[(1.1, -2.2), (3.3, 4.4)], [(-5.5, 6.6), (-7.7, -8.8)]]} |
Map$<$int , Vector<int> $>$ |
|
$ \left\{ 0, \left\langle \begin{array}{cccccc} 1 & -2 & 3 & -4 & 5 & -6 \end{array} \right\rangle \right\} $ |
{'DATA': {0: [1, -2, 3, -4, 5, -6]}} |
Map$<$int , Vector<float> $>$ |
|
$ \left\{ 0, \left\langle \begin{array}{cccccc} 1.1 & -2.2 & 3.3 & -4.4 & 5.5 & -6.6 \end{array} \right\rangle \right\} $ |
{'DATA': {0: [1.1, -2.2, 3.3, -4.4, 5.5, -6.6]}} |
Map$<$int , Vector<complex<float> > $>$ |
|
$ \left\{ 0, \left\langle \begin{array}{cccccc} 1.1 - 2.2i & 3.3 + 4.4i & 5.5 - 6.6i \end{array} \right\rangle \right\} $ |
{'DATA': {0: [(1.1, -2.2), (3.3, 4.4), (5.5, -6.6)]}} |
Map$<$int , Matrix<int> $>$ |
|
$ \left\{ 0, \left[ \begin{array}{cc} 1 & -2\\ -3 & 4\\ 5 & 6\\ \end{array} \right] \right\} $ |
{'DATA': {0: [[1, -2], [-3, 4], [5, 6]]}} |
Map$<$int , Matrix<float> $>$ |
|
$ \left\{ 0, \left[ \begin{array}{cc} 1.1 & -2.2\\ -3.3 & 4.4\\ 5.5 & 6.6\\ \end{array} \right] \right\} $ |
{'DATA': {0: [[1.1, -2.2], [-3.3, 4.4], [5.5, 6.6]]}} |
Map$<$int , Matrix<complex<float> > $>$ |
|
$ \left\{ 0, \left[ \begin{array}{cc} 1.1 - 2.2i & 3.3 + 4.4i\\ -5.5 + 6.6i & -7.7 - 8.8i\\ \end{array} \right] \right\} $ |
{'DATA': {0: [[(1.1, -2.2), (3.3, 4.4)], [(-5.5, 6.6), (-7.7, -8.8)]]}} |