ArrayToJSON |
Type | function |
Dictionary | LCS |
Library | LiveCode Script |
Syntax | ArrayToJSON(<pArray>,<pForceRootType>,<pPretty>)
|
Associations | ws.goulding.script-library.mergjson |
Summary | Parse a LiveCode array to JSON
|
Parameters | Name | Type | Description |
---|
pArray | | A LiveCode array
|
pForceRootType | | Force an element value to be represented
as a JSON type other than the default
- "object" - force an object even if the array has numeric 1...N keys
- "string" - force a string even if the element value parses as a number or boolean
|
|
Example | local tMessage
ask question "What do you want to send?"
if it is not empty then
put it into tMessage["text"]
put ArrayToJSON(tMessage) into tMessage
set the httpHeaders to "Content-type: application/json"
post tMessage to url kSlackWebhookURL
end if
|
Values | Name | Type | Description |
---|
return | | A UTF8 encoded JSON string
|
|
Description | By default LiveCode numerically indexed arrays with keys 1...N are
translated to JSON arrays and LiveCode array key - value pairs are
translated to JSON objects.
|