Experimental:JSON DAT

From TouchDesigner Documentation
Jump to: navigation, search

Summary
[edit]

The JSON DAT converts and filters JSON text using JSONPath syntax and outputs the filtered results. It eliminates having to code scripts to parse and manipulate JSON, and keeps the data flow procedural.

It expects JSON text as input and converts the input to a Python object in the DAT.source member.

It then filters the JSON down using the JSONPath Filter parameter, and it outputs the resulting data from the DAT as JSON text.

It also puts the filtered results as DAT.results (a Python list of results) and DAT.result (the first result).

You can test expressions on DAT.source, DAT.result and DAT.results by setting the Output menu to Expression and using expressions like me.result['city'], which outputs the evaluated expression from the DAT. You can then use that expression as op('json1').result['city'] in an expression elsewhere. DAT.expr is also a member of the JSON DAT, for example, op('json1').expr.

See also: JSONPath, OP Snippets.

PythonIcon.pngjsonDAT_Class


Parameters - JSON Page

Filter filter - A filter string following JSONPath syntax that will be used to filter the input JSON.  

Output output - - Select the output of the JSON DAT.

  • Filter Result filterresult - Outputs list returned from applying the filter to the JSON text input.
  • Expression expression - Output a custom expression.

Expression expression - The custom expression to output  

Format Output formatoutput - When enabled, the output of the DAT will formatted with indents and newlines.  


Parameters - Common Page

Language language - - Select how the DAT decides which script language to operate on.

  • Input input - The DAT uses the inputs script language.
  • Node node - The DAT uses it's own script language.

Edit/View Extension extension - - Select the file extension this DAT should expose to external editors.

  • dat dat - various common file extensions.
  • frag frag -
  • glsl glsl -
  • html html -
  • md md -
  • py py -
  • rtf rtf -
  • tsv tsv -
  • txt txt -
  • vert vert -
  • xml xml -
  • From Language languageext - pick extension from DATs script language.
  • Custom Extension customext - Specify a custom extension.

Custom Extension customext - Specifiy the custom extension.  

Word Wrap wordwrap - - Enable Word Wrap for Node Display.

  • Input input - The DAT uses the inputs setting.
  • On on - Turn on Word Wrap.
  • Off off - Turn off Word Wrap.


Operator Inputs

  • Input 0 - A JSON text input.


DATs
Art-Net • CHOP Execute • CHOP to • Clip • Convert • CPlusPlus • DAT •  Execute • DAT xport • Error • EtherDream • Evaluate • Examine • Execute • FIFO • File In • File Out • Folder • In • Indices • Info • Insert • Experimental:JSON • Keyboard In • Lookup • Merge • MIDI Event • MIDI In • Monitors • MQTT Client • Multi Touch In • NDI • Null • OP Execute • OP Find • OSC In • OSC Out • Out • Panel Execute • Parameter • Parameter Execute • Perform • Render Pick • Reorder • Script • Select • Serial • SocketIO • SOP to • Sort • Substitute • Switch • Table • TCP/IP • Text • Touch In • Touch Out • Transpose • TUIO In • UDP In • UDP Out • UDT In • UDT Out • Web Client • Web • Web Server • WebSocket • XML

An Operator Family that manipulates text strings: multi-line text or tables. Multi-line text is often a command Script, but can be any multi-line text. Tables are rows and columns of cells, each containing a text string.

Operators that have 1 or more input, like a Math CHOP, are called filters. See Generator.

A text string that contains data (string, float, list, boolean, etc.) and operators (+ * < etc) that are evaluated by the node's language (python or Tscript) and returns a string, float list or boolean, etc. Expressions are used in parameters, DATs and in scripts.

OP Snippets is a set of numerous examples of TouchDesigner operators, which you access via the Help menu. These can be copied/pasted into your projects.

The generic thing that holds an Operator, and includes Flags (display, bypass, lock, render, immune) and its position/size in the network. Whether you "lay down an Operator" or "lay down an Node", you're doing the same thing.