Overview

The following is a reference to all commands and identifiers provided by JSON For mIRC. To understand this documentation you must first understand the following.

Parameters: Most of the commands and identifiers provided by JSON For Mirc requires some form of input; that input is referred to as a parameter. Different commands or identifiers may use the same name for a parameter but each parameter's meaning and requirements are unique to the command or identifier that specified it.

Switches: Switches alter how a command processes parameters or behaves after the parameters has been processed. If the first parameter of a command begins with - it is a switch. Unless otherwise stated all switches are optional and should only be used to enact the alternative processing.

Props: Props alter how an identifier processes parameters or behaves after the parameters has been processed. . is used to suffix props to identifiers. Props should only be specified to enact the alternative processing.

/JSONList
Lists all open JSON handles.
/JSONOpen -dbfuUw Name Input
Creates a JSON handle and parsers the input when applicatable.
Switches
-d
Closes the JSON handle and all children when the calling script finishes processing.
-b
Input is the name of a bvar containing the JSON to parse.
This switch cannot be used with the -f u or -U switches.
-f
Input is the path to a file containing the JSON to parse.
This switch cannot be used with the -b -u or -U switches.
-u
Input is a URL of which to retrieve the JSON data from.
This switch cannot be used with the -b -f or -U switches.
-U
Input is a URL of which to retrieve the data from.
Parsing the retrieved data will not be attempted.
This switch is provided to allow non-JSON data to be downloaded using the methodology provided by the script.
This switch cannot be used with the -b -f or -u switches.
-i
The HTTP request will ignore al SSL certificate errors.
This switch can only be used if the -u or -U switch is specified.
-R
The HTTP request will not follow redirects
This switch can only be used if the -u or -U switch is specified.
-w
The HTTP request should wait until /JSONHttpFetch is called. This is to allow the request method and headers to be set.
This switch can only be used if the -u or -U switch is specified.
Parameters
Name - Required
The name to be used to reference the JSON instance.
Must not be an unsigned integer value or contain the characters :, ?, *
Input - Required
The input JSON data to be parsed
If the -b switch is specified the input will be considered a bvar
If the -f switch is specified the input will be considered a file
If the -u or -U switch is specified the input will be considered a URL
/JSONHttpMethod Name Method
Sets the request method for a JSON handle's pending HTTP request.
Parameters
Name - Required
The JSON handle name of which to set the HTTP method.
The handle must have been created with the -w switch and the HTTP request must be pending.
Input - Required
The method of which to use when the HTTP request is made.
Examples include GET, POST, PUT, DELETE.
/JSONHttpHeader Name Header Value
Stores the header for a pending HTTP request.
Parameters
Name - Required
The JSON handle name of which to store the header for.
The handle must have been created with the -w switch and the HTTP request must be pending.
Header - Required
The name of the header to set.
Examples include Content-Type, Content-Length, Authorization, Cookie.
Value - Required
The value to store for the header.
/JSONHttpFetch -bf Name Data
Performs a pending HTTP request.
Switches
-b
Data is the name of a bvar of which contains the data to send with the request.
This switch cannot be used with the -f switch.
-f
Data is the path to a file containing the data to send with the request.
This switch cannot be used with the -b switch.
Parameters
Name - Required
The JSON handle name of which to store the header for.
The handle must have been created with the -w switch and the HTTP request must be pending.
Data - Optional
The data to send with the request.
If the -b switch is specified Data will be considered a bvar.
If the -f switch is specified Data will be considered a file.
Notes
If certain headers have not been specified the following default values will be used:
Host: <site_host>
User-Agent: Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)
Accept: */*
Accept-Language: <system_lang>

Only applicable if data is being sent:
Content-Type: application/x-www-form-urlencoded
Content-Length: <data_length>
/JSONClose -w Name
Closes the specified handle freeing all resources associated with it.
Switches
-w
Indicates Name is a wildcard of which all matching handles are to be closed
Parameters
Name - Required
The name of the handle to close.
If the -w switch is used, all matching handles will be closed.
/JSONShutdown
Closes all JSON handles and frees all resources related to the script.
$JSONError
Returns the error message of the last call if it resulted in an error.
The error flag is reset with each JSON call so this should be checked after each call to insure an error isn't masked by a subsequent call.
$JSON(Name|Ref|N, Members...)
Returns a reference to the JSON handler if it exists.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open json handle is returned.
If N is 0 the total number of JSON handles is returned.
Members - Optional
A list of members within the handle's JSON data to sequentially walk prior to returning a reference.
When specified, a reference to the accessed item is returned.
Each member is passed as an additional paramater to the identifer.
Not applicable if Name|Ref|N is 0.
$JSON(Name|Ref|N, Members...) Fuzzy Prefix
Uses fuzzy-walking when accessing members and returns a reference to the accessed item.
Fuzzy inputs ignore casing and numerical values will be treated solely as indexes instead of keys for the purposes of walking the JSON data.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is walked.
Members - Required
A list of members within the handle's JSON data to sequentially walk prior to returning a reference.
If a member is prefixed with ~ it will be treated as a fuzzy input during lookup.
if a member is prefixed with = it will be treated as a literal key.
Fuzzy-lookups only take place on objects; All other data-types ignore fuzzy flags if they are walked.
$JSON(Name|Ref|N, Members...) ToBvar Suffix
Outputs the result into a unique bvar and returns the bvar
All $JSON() props support being suffixed with ToBvar
This prop suffix cannot be used with the ToFile prop suffix
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
Members... - Optional
A list of members within the handle's JSON data to sequentially walk.
$JSON(Name|Ref|N, File, Members...) ToFile Suffix
Outputs the result into the specified file.
All $JSON() props support being suffixed with ToFile
This prop suffix cannot be used with the ToBvar prop suffix
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
File - Required
The path to the file to write the result to.
The file must not exist prior to the $JSON() call.
The File parameter is required to be the 2nd parameter.
All parameters that would normally follow directly after the Name parameter are to be shifted to the right one slot.
Members... - Optional
A list of members within the handle's JSON data to sequentially walk.
$JSON(Name|Ref|N).State
Returns the JSON handle's state: init, http_pending, parse_pending, done
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
$JSON(Name|Ref|N).InputType
Returns the JSON handle's input type: text or http
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
$JSON(Name|Ref|N).Input
Returns the JSON handle's input data prior to attempting to parse.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
$JSON(Name|Ref|N).IsChild
Returns $true or $false dependent on if the JSON handle is a child reference to another JSON handle.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
$JSON(Name|Ref|N).HttpParse
Returns $true or $false dependent on if the JSON handle is supposed to parse the retrieved data from an HTTP request.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
$JSON(Name|Ref|N).HttpStatus
Returns the HTTP status code of a completed HTTP request for the JSON handle.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
$JSON(Name|Ref|N).HttpStatusText
Returns the HTTP status text of a completed HTTP request for the JSON handle.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
$JSON(Name|Ref|N, Header).HttpHeader
Returns the value for the first matching HTTP response header.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
Header - Required
The response header of which to retrieve the value of.
$JSON(Name|Ref|N).HttpHeaders
Returns all of the HTTP response headers, separated by $crlf as the were received from the server.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
$JSON(Name|Ref|N).HttpHead
Returns the HTTP response status code, status text and headers as they were received from the server.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
$JSON(Name|Ref|N).HttpBody
Returns all of the HTTP response body as it was received from the server.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
$JSON(Name|Ref|N).HttpResponse
Returns the full HTTP response as it was received from the server.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
$JSON(Name|Ref|N, Members...).Path
Returns a string representation of the path followed to reach the accessed item.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
Members... - Optional
A list of members within the handle's JSON data to sequentially walk.
$JSON(Name|Ref|N, Members...).Type
Returns the data-type of the accessed item.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
Members... - Optional
A list of members within the handle's JSON data to sequentially walk.
$JSON(Name|Ref|N, Members...).IsContainer
Returns $true or $false if the accessed item is a container data-type.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
Members... - Optional
A list of members within the handle's JSON data to sequentially walk.
$JSON(Name|Ref|N, Members...).Lengh
Returns the length of the accessed item.
Only applicable for Strings, Arrays, and Objects.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
Members... - Optional
A list of members within the handle's JSON data to sequentially walk.
$JSON(Name|Ref|N, Members...).Value
Returns the value of the accessed item. Only applicable for items of null, boolean, number, and string data-types.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
Members... - Optional
A list of members within the handle's JSON data to sequentially walk.
$JSON(Name|Ref|N, Members...).String
Returns the accessed item's value as a JSON parsable string.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
Members... - Optional
A list of members within the handle's JSON data to sequentially walk.
$JSON(Name|Ref|N, Members...).Debug
Returns a JSON parsable string containing debug all information stored pertaining to the handle.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
Members... - Optional
A list of members within the handle's JSON data to sequentially walk.
$JSON(Name|Ref|N, Members...).Error
Returns any errors that occurred while attempting to retrieve and parse the input JSON.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to access.
If N is an unsigned integer, the Nth open JSON handle is accessed.
Members... - Optional
A list of members within the handle's JSON data to sequentially walk.
$JSONPath(Name|Ref, Index)
Returns the Nth key in the accessed item's path.
Parameters
Name|Ref - Required
The name of the handle or handle reference to access.
index - Required
The index of the path item to return.
If 0 the total number of items in the path are returned.
$JSONForEach(Name|Ref|N, Command, Members...)
Loops over all members of the reference calling the specified command then returns the total number of items looped over.
Parameters
Name|Ref|N - Required
The name of the handle or handle reference to loop over.
If N is an unsigned integer, the Nth open JSON handle is accessed.
Command - Required
The alias to call as a command for each item looped over.
The alias is passed a reference of which $JSON() can be used to retrieve information pretaining to the item.
Members... - Required
A list of members to sequentially walk within the looped item prior to calling Command Not applicable if the .Walk prop is specified
Props
.Fuzzy
Indicates that Command should use fuzzy walking as explained in Fuzzy Prop Prefix.
.Walk
Recursively walks all children(and their children and so on) of the reference and calls Command for all primitive items.
Members... should NOT be specified if this prop is used.
Notes
$JSONItem can be used for quicker access to a limited set of data related to the looped item.
$JSONItem(Query)
Returns various information related to the item currently being looped over by $JSONForEach
Parameters
Query - Required
Indicates what information about the item handle to retrieve.
Valid inputs are Value, ValueToBvar, Length, IsContainer, and Type
$JSONVersion(Short)
Returns the scripts current version
Parameters
Short - Optional
If not-null, then a shortened version is returned formatted as x.y.z.
SReject © 2016-2017