Description
The function JSONPackage
generates a JSON object string from the specified parameters. The parameters must always be provided in pairs, where the first parameter of a pair is the key and the second is the corresponding value.
Syntax
JSONPackage(key, value, ...)
Arguments
Argument | Description |
---|---|
key |
The key of the JSON object. Must be a string. |
value |
The value associated with the key. Can be any data type (string, number, boolean, etc.). |
Return Type
The function returns a JSON string representing the provided key-value pairs.
Examples
Description | Formula |
---|---|
Creating a simple JSON object |
JSONPackage( "Name", "John Doe", "Age", 30, "Occupation", "Developer" ) Result: {"Name":"John Doe","Age":30,"Occupation":"Developer"} |
Usage within an HTTP-POST request |
HTTPPost( "https://example.com/api", "application/json; charset=utf-8", JSONPackage( "ID", 12345, "Status", "active", "User", getUserName() ) ) |
Notes
- Ensure that the keys are unique to avoid conflicts within the JSON object.
- The function is especially useful for integration with APIs that expect JSON objects.
- Key-value pairs must be provided in the correct order (always in pairs).
Comments
0 comments
Please sign in to leave a comment.