ScriptTap
JSON

Command video guide

JSON

JSON reads structured text already stored in a String variable. Use it to extract typed values, test whether a path exists, measure an array/object/String, or serialize a selected value. This Overview shows every operation without Test or Play. The nine existing mode guides provide complete working examples.

Manually drag JSON from Variables or Recent into a new script. Use In selects This Script Only or Script Thread for the output-variable scope. JSON String is the name of an earlier String holding valid JSON, not a document-entry box. SetVariable, File or HTTP can supply that String.

Path Source Text accepts a fixed path; String var reads the complete path from an earlier String. A path starts with $; $.name selects a property and [0] selects the first JSON array item. This is not a general wildcard query.

Extract offers String, Integer, Decimal, Boolean, String Array and JSON Text. Match the selected JSON value and destination types. String reads plain text without JSON quotation marks. Numeric and Boolean choices require compatible JSON values. String Array writes non-null items as Strings into a one-letter String family, beginning at the one-based Start index; nested objects/arrays become compact JSON text. Null items are a type error. Save Count optionally writes the item count into an Integer. Leave room for the destination range. JSON path indexes are zero-based; ScriptTap destination indexes are one-based. JSON Text serializes a selected value into a String, retaining its JSON structure and quotation marks.

Exists writes a Boolean. A present null value still exists; a missing path produces false without making the operation fail. Length writes an Integer count of array items, object members or String characters; numeric/Boolean values are not length targets. Stringify writes compact or indented Pretty JSON into a String. Use the root path for the whole document. It does not automatically modify the original input String.

Save Outputs optionally adds Success (Boolean) and Error (String) beside the main output. Success is distinct from the Boolean returned by Exists. Use a separate diagnostic String destination. Enabled outputs need valid variable names. Test previews the draft rather than playing the complete script; earlier runtime values may be unavailable. Changing mode clears outgoing operation settings while keeping common source/path/scope/result choices. This tour cancels its draft and never runs Test or Play.

Overview

Step-by-step guide

  1. Step 01

    JSON is a structured text format used by many apps and web services. ScriptTap's JSON command reads values from that text, checks whether a path exists, measures a selected value, or writes it back as JSON. This overview shows the options without running a demonstration.

    JSON: Overview step 1: JSON is a structured text format used by many apps and web services. ScriptTap's JSON command reads values from that text, checks whether a path exists, measures a selected value, or writes it back as JSON. This overview shows the options without running a demonstration.
  2. Step 02

    Create a blank script for this option tour. The separate mode guides show complete working examples, including the supporting commands that supply JSON and display the result.

    JSON: Overview step 2: Create a blank script for this option tour. The separate mode guides show complete working examples, including the supporting commands that supply JSON and display the result.
  3. Step 03

    Give the new script a name, then open its editor. We will inspect one JSON command and close its settings without saving the tour's draft values.

    JSON: Overview step 3: Give the new script a name, then open its editor. We will inspect one JSON command and close its settings without saving the tour's draft values.
  4. Step 04

    Drag JSON into the script and open the row you placed. You can find it under Variables, or in Recent after using it. The command starts in extract mode.

    JSON: Overview step 4: Drag JSON into the script and open the row you placed. You can find it under Variables, or in Recent after using it. The command starts in extract mode.
  5. Step 05

    Use In sets the scope of the output variables. This Script Only keeps them local. Script Thread lets related scripts in the same thread use them. Choose the scope that matches the commands consuming your results, and return to This Script Only for this tour.

    JSON: Overview step 5: Use In sets the scope of the output variables. This Script Only keeps them local. Script Thread lets related scripts in the same thread use them. Choose the scope that matches the commands consuming your results, and return to This Script Only for this tour.
  6. Step 06

    JSON String takes the name of an earlier String variable containing valid JSON, such as s1. It is not a box for entering a JSON document directly. SetVariable, File, or HTTP can supply that String before this command runs.

    JSON: Overview step 6: JSON String takes the name of an earlier String variable containing valid JSON, such as s1. It is not a box for entering a JSON document directly. SetVariable, File, or HTTP can supply that String before this command runs.
  7. Step 07

    Path identifies the value inside the document. Keep Path Source on Text to enter a fixed path. A dollar sign means the root; dollar dot name selects the name property. JSON array indexes start at zero, so bracket zero selects the first item. This is not a general wildcard query.

    JSON: Overview step 7: Path identifies the value inside the document. Keep Path Source on Text to enter a fixed path. A dollar sign means the root; dollar dot name selects the name property. JSON array indexes start at zero, so bracket zero selects the first item. This is not a general wildcard query.
  8. Step 08

    Choose String var when an earlier String variable holds the complete path. This lets another command decide which value to read. The JSON source String and the path String are separate inputs. Return to Text for the rest of this tour.

    JSON: Overview step 8: Choose String var when an earlier String variable holds the complete path. This lets another command decide which value to read. The JSON source String and the path String are separate inputs. Return to Text for the rest of this tour.
  9. Step 09

    Mode offers extract, exists, length, and stringify. Extract reads the selected value into the chosen output type. String reads a JSON text value without its surrounding JSON quotation marks. Supply a String destination; choose a numeric output instead when the value is a number.

    JSON: Overview step 9: Mode offers extract, exists, length, and stringify. Extract reads the selected value into the chosen output type. String reads a JSON text value without its surrounding JSON quotation marks. Supply a String destination; choose a numeric output instead when the value is a number.
  10. Step 10

    Integer extracts a compatible whole number into an Integer variable. The value must fit ScriptTap's Integer range. Quoted numeric text is still a JSON String, not the same as a JSON number.

    JSON: Overview step 10: Integer extracts a compatible whole number into an Integer variable. The value must fit ScriptTap's Integer range. Quoted numeric text is still a JSON String, not the same as a JSON number.
  11. Step 11

    Decimal extracts a JSON number into a Decimal variable. Use it for values with a fractional part, or when later commands need decimal arithmetic. Match the destination variable's type to the selected output.

    JSON: Overview step 11: Decimal extracts a JSON number into a Decimal variable. Use it for values with a fractional part, or when later commands need decimal arithmetic. Match the destination variable's type to the selected output.
  12. Step 12

    Boolean extracts a JSON true or false value into a Boolean variable. A later condition can branch on that result. The words true and false inside quotation marks are Strings, not Boolean values.

    JSON: Overview step 12: Boolean extracts a JSON true or false value into a Boolean variable. A later condition can branch on that result. The words true and false inside quotation marks are Strings, not Boolean values.
  13. Step 13

    String Array reads a selected JSON array into a ScriptTap String family. Enter its one-letter destination and a one-based Start index. Each non-null item becomes a String; nested objects and arrays become compact JSON text. Null array items cause a type error. Leave room for the resulting range.

    JSON: Overview step 13: String Array reads a selected JSON array into a ScriptTap String family. Enter its one-letter destination and a one-based Start index. Each non-null item becomes a String; nested objects and arrays become compact JSON text. Null array items cause a type error. Leave room for the resulting range.
  14. Step 14

    Save Count optionally writes the number of extracted array items into an Integer variable. This helps later commands process the results. Remember the difference: JSON path indexes begin at zero, while these ScriptTap destination indexes begin at one.

    JSON: Overview step 14: Save Count optionally writes the number of extracted array items into an Integer variable. This helps later commands process the results. Remember the difference: JSON path indexes begin at zero, while these ScriptTap destination indexes begin at one.
  15. Step 15

    JSON Text serializes the selected value into a String. Objects and arrays keep their JSON structure. A selected JSON String keeps its JSON quotation marks, unlike String extraction. Use this when a later command needs a JSON fragment rather than only its plain text.

    JSON: Overview step 15: JSON Text serializes the selected value into a String. Objects and arrays keep their JSON structure. A selected JSON String keeps its JSON quotation marks, unlike String extraction. Use this when a later command needs a JSON fragment rather than only its plain text.
  16. Step 16

    Exists writes a Boolean telling you whether the selected path is present. A present value of null still exists. A missing path returns false, which is a normal check result, not an operation failure. Invalid JSON or an invalid path is a different problem.

    JSON: Overview step 16: Exists writes a Boolean telling you whether the selected path is present. A present value of null still exists. A missing path returns false, which is a normal check result, not an operation failure. Invalid JSON or an invalid path is a different problem.
  17. Step 17

    Length writes an Integer. For an array, it counts items. For an object, it counts members. For a String, it counts characters. A number or Boolean is not a supported length value. Use the path to choose exactly what should be measured.

    JSON: Overview step 17: Length writes an Integer. For an array, it counts items. For an object, it counts members. For a String, it counts characters. A number or Boolean is not a supported length value. Use the path to choose exactly what should be measured.
  18. Step 18

    Stringify writes the selected value back into a String containing JSON. Compact removes presentation whitespace. Pretty adds indentation for easier reading. Use the root path to format the whole document. This creates an output String; it does not edit the original source String automatically.

    JSON: Overview step 18: Stringify writes the selected value back into a String containing JSON. Compact removes presentation whitespace. Pretty adds indentation for easier reading. Use the root path to format the whole document. This creates an output String; it does not edit the original source String automatically.
  19. Step 19

    Save Outputs adds optional Success and Error results alongside the mode's main output. Success uses a Boolean destination and reports whether the operation succeeded. It is different from an exists result: a successful check can report that the path does not exist.

    JSON: Overview step 19: Save Outputs adds optional Success and Error results alongside the mode's main output. Success uses a Boolean destination and reports whether the operation succeeded. It is different from an exists result: a successful check can report that the path does not exist.
  20. Step 20

    Error uses a String destination for diagnostic text, such as an invalid document or incompatible value. Use a separate destination from your main text result. Enable only the outputs you need and provide valid variable names before saving a working command.

    JSON: Overview step 20: Error uses a String destination for diagnostic text, such as an invalid document or incompatible value. Use a separate destination from your main text result. Enable only the outputs you need and provide valid variable names before saving a working command.
  21. Step 21

    Test checks the current draft without playing the whole script. Earlier runtime variable values may be unavailable in an editor preview. We leave Test unused here; the individual mode guides show complete scripts with real input and visible results.

    JSON: Overview step 21: Test checks the current draft without playing the whole script. Earlier runtime variable values may be unavailable in an editor preview. We leave Test unused here; the individual mode guides show complete scripts with real input and visible results.
  22. Step 22

    Changing mode clears the outgoing operation's settings, while the source, path, and shared output choices remain. Review the fields before using OK. This overview closes with the X without saving its draft or playing. Choose a mode tab for the shortest useful setup and actual result.

    JSON: Overview step 22: Changing mode clears the outgoing operation's settings, while the source, path, and shared output choices remain. Review the fields before using OK. This overview closes with the X without saving its draft or playing. Choose a mode tab for the shortest useful setup and actual result.