JSON Syntax for Passing Parameters to Scripts (2024)

The JavaScript Object Notation (JSON) syntax contains a list of objects in brackets, colon separated with a key-value format.

Values can be:

  • Boolean, integer, real, floating point, strings in double quotes ("")
  • Array: ordered list of values, colon separated in square brackets ([])
  • Associative array : array in square brackets ([]) whose elements can be key-value couples, colon separated in curly brackets ({})
  • null

Note that it is possible to pass only one JSON whose proprieties are considered separated parameters. If deeper levels are available (as in the case of associative arrays) even though those levels are allowed, they are not considered parameters for the script.

The names of the parameters specified in the script may or may not be the same as those provided to the user. It the names are the same, they can be sorted differently from what specified in the script. If the names are not the same, they are sorted as provided to the user.

Examples

//The script is executed with a parameter, let's say "input"

read(input, "value")

If the script is invoked passing the object "System1:View:View.object" as parameter, the read operation (as defined in the script) is executed on the object provided. If you change the parameter, you change the object on which the operation will be executed.

//The script is executed with a parameter, let's say "choice"

if (choice === "read") {

read(...)

}

else if (choice === "execute") {

executeCommand(....)

}

If the script is invoked by passing the "read" string, the read operation will be executed; if the "execute" string is passed, a command will be executed.

console("a: " + a + "; b: " + b);

parameter specified

{ "a": "value of a", "b": "value of b" }

This script will write in the Console expander the following string: a: value of a; b: value of b. The output in the Console expander is the same also with shuffled inputs. If the keys defined in the JSON do not match with the parameters names, the parameters will be provided in ordinal sorts. See the following example:

console("a: " + a + "; b: " + b);

parameter specified

{ "b": "value of b", "a": "value of a" }

For the JSON input { "b": "value of b", "a": "value of a" } the output in the Console expander is: c: value of b; d: value of a.

...

//Do Something

...

//parameter specified

{

"a": "value of a",

"b": [

{"c": "value of c"},

{"d": "value of d"}

]

}

//that is

{ "a": "value of a", "b": [{"c": "value of c"}, {"d": "value of d"}]}

In the above example, only one JSON is passed as parameter (The Script Engine considers a and b as separate parameters. Furthermore, b contains an array, which means that it is possible to use b.c construct in the script with value c while construct b.d with value d.

JSON Syntax for Passing Parameters to Scripts (2024)
Top Articles
How Credit Cards Affect Your Credit Rating
4 Common Cash Flow Problems And Its Causes - Velotrade
What Did Bimbo Airhead Reply When Asked
UPS Paketshop: Filialen & Standorte
Amc Near My Location
Craigslist Vans
Kaydengodly
Bucks County Job Requisitions
Pitt Authorized User
<i>1883</i>'s Isabel May Opens Up About the <i>Yellowstone</i> Prequel
Premier Boating Center Conroe
Sport Clip Hours
Diablo 3 Metascore
2016 Ford Fusion Belt Diagram
Mineral Wells Independent School District
Colorado mayor, police respond to Trump's claims that Venezuelan gang is 'taking over'
What Happened To Anna Citron Lansky
Locate At&T Store Near Me
Niche Crime Rate
Wgu Academy Phone Number
Project, Time & Expense Tracking Software for Business
Www.publicsurplus.com Motor Pool
Craigslist Battle Ground Washington
Valic Eremit
Hctc Speed Test
Arrest Gif
Jesus Revolution Showtimes Near Regal Stonecrest
Speedstepper
Free T33N Leaks
2004 Honda Odyssey Firing Order
Frank Vascellaro
Korg Forums :: View topic
Robot or human?
Does Iherb Accept Ebt
Western Gold Gateway
Vanessa West Tripod Jeffrey Dahmer
Bimmerpost version for Porsche forum?
How To Get Soul Reaper Knife In Critical Legends
Wsbtv Fish And Game Report
NHL training camps open with Swayman's status with the Bruins among the many questions
Dr Adj Redist Cadv Prin Amex Charge
Anhedönia Last Name Origin
Gasoline Prices At Sam's Club
Promo Code Blackout Bingo 2023
Shell Gas Stations Prices
Rs3 Nature Spirit Quick Guide
4k Movie, Streaming, Blu-Ray Disc, and Home Theater Product Reviews & News
Matt Brickman Wikipedia
Suzanne Olsen Swift River
Affidea ExpressCare - Affidea Ireland
Ravenna Greataxe
Latest Posts
Article information

Author: Terence Hammes MD

Last Updated:

Views: 5964

Rating: 4.9 / 5 (69 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Terence Hammes MD

Birthday: 1992-04-11

Address: Suite 408 9446 Mercy Mews, West Roxie, CT 04904

Phone: +50312511349175

Job: Product Consulting Liaison

Hobby: Jogging, Motor sports, Nordic skating, Jigsaw puzzles, Bird watching, Nordic skating, Sculpting

Introduction: My name is Terence Hammes MD, I am a inexpensive, energetic, jolly, faithful, cheerful, proud, rich person who loves writing and wants to share my knowledge and understanding with you.