Back to Home
$jsonStringify
$jsonStringify converts the current JSON object back into a
compact single-line string. Use it when saving the object to a variable
or sending it as an HTTP request body.
Syntax
$jsonStringify
No parameters.
Returns empty if no $jsonParse or
$jsonSet was called, or $jsonClear was
called.
What happens
$jsonParseloads the JSON object into memory.-
Any edits via
$jsonSetor$jsonUnsetare applied. -
$jsonStringifyconverts the entire current object into a single-line JSON string and returns it.
Example 1: Stringify a simple object
$nomention
$jsonParse[{"username":"Zubariel","level":10}]
$jsonStringify
What happens:
$jsonParseloads the object.$jsonStringifyoutputs it as a compact string.
Output:
{"username":"Zubariel","level":10}
Example 2: Modify then stringify
$nomention
$jsonParse[{"coins":100,"level":1}]
$jsonSet[coins;250]
$jsonStringify
What happens:
$jsonParseloads the object.$jsonSet[coins;250]updates the coins value.-
$jsonStringifyoutputs the updated object as a compact string.
Output:
{"coins":250,"level":1}
Common uses
-
Saving to a variable: always stringify before
passing to
$setVar - Sending to an API: convert the object to a string for an HTTP request body
- Debugging: quickly inspect the full object after a series of edits
See also
- $jsonPretty: for a human-readable formatted version instead
- $jsonParse: to reload the stringified output later