Passa al contenuto principale

JSON, colors and links

Read and write JSON, convert colors, and split or encode links.

Read JSON as a shape value​

Turns JSON text into one shape value following one of the shapes this module or server has declared, checking the text against that shape's fields as it goes. Every field then comes back with the right kind of value, so you never have to convert it again. If the text is not valid JSON, or does not match the shape, the action fails and you can catch it with 'Try'.

Inputs

NameTypeRequiredDetails
JSON textTextYesThe JSON text to read. It must describe a single object, not a list.
ShapeShapeYesWhich shape the text has to match. It decides which fields must be present and what kind of value each one holds.

Outputs

NameTypeDetails
Shape valueShape valueThe shape value read from the text.

Read JSON as a list of shape values​

Turns JSON text that holds a list into shape values of one declared shape, checking every item against that shape's fields. Fields the shape does not declare are ignored. If the text is not valid JSON, is not a list, or an item does not match, the action fails and you can catch it with 'Try'.

Inputs

NameTypeRequiredDetails
JSON textTextYesThe JSON text to read. It must describe a list of objects.
ShapeShapeYesWhich shape every item has to match.

Outputs

NameTypeDetails
Shape valuesList of Shape valueThe shape values read from the text, in list order.

Write value as JSON​

Turns a value into JSON text, so you can store it in one place or send it somewhere else. Read it back later with 'Read JSON as a shape value'.

Inputs

NameTypeRequiredDetails
ValueAnyYesThe value to write out. Shape values, lists, lookup tables, texts, numbers and yes/no values all work.
Easy to readYes/NoNoSpread the text over several lines with indentation. Nice when a person reads it, longer when it is stored.

Outputs

NameTypeDetails
JSON textTextThe value as JSON text.

Color from hex​

Builds a color from a hex code (e.g. #5865F2).

Inputs

NameTypeRequiredDetails
HexTextYesSix-digit hex color, optionally prefixed with #. Must match ^#?[0-9a-fA-F]{6}$.

Outputs

NameTypeDetails
ColorColorThe resulting color.

Color to hex​

Returns the hex text for a color (e.g. #5865F2).

Inputs

NameTypeRequiredDetails
ColorColorYesThe color to convert.

Outputs

NameTypeDetails
HexTextHex text with leading #.

Color from RGB​

Builds a color from red, green, and blue components (0-255).

Inputs

NameTypeRequiredDetails
RedWhole numberYesRed component (0-255). Value: 0 to 255.
GreenWhole numberYesGreen component (0-255). Value: 0 to 255.
BlueWhole numberYesBlue component (0-255). Value: 0 to 255.

Outputs

NameTypeDetails
ColorColorThe resulting color.

Color to RGB​

Splits a color into its red, green, and blue components (0-255). The inverse of Color from RGB.

Inputs

NameTypeRequiredDetails
ColorColorYesThe color to split.

Outputs

NameTypeDetails
RedWhole numberRed component (0-255).
GreenWhole numberGreen component (0-255).
BlueWhole numberBlue component (0-255).

Split URL into parts​

Splits a URL into its parts (protocol, host, port, path, query, fragment). Fails if the URL is invalid.

Inputs

NameTypeRequiredDetails
URLURLYesThe URL to split.

Outputs

NameTypeDetails
ProtocolTextThe scheme without the trailing colon, e.g. "https".
HostTextThe hostname without port, lowercased, e.g. "example.com".
PortTextThe port as text, or empty when the URL uses the scheme's default port.
PathTextThe path, e.g. "/a/b"; "/" when the URL has no path.
QueryTextThe raw query without the leading "?"; empty when there is none.
FragmentTextThe fragment without the leading "#"; empty when there is none.

Get URL query parameter​

Reads a single query parameter from a URL. Returns an empty value when the parameter is absent.

Inputs

NameTypeRequiredDetails
URLURLYesThe URL to read the parameter from.
ParameterTextYesThe name of the query parameter. Repeated parameters return the first value.

Outputs

NameTypeDetails
ValueTextThe parameter's value, or empty if it is not present. May be empty.

URL-encode​

Percent-encodes text so it is safe to use inside a URL component.

Inputs

NameTypeRequiredDetails
TextTextYesThe text to encode.

Outputs

NameTypeDetails
ResultTextThe percent-encoded text.

URL-decode​

Decodes percent-encoded text. Fails if the input contains a malformed escape.

Inputs

NameTypeRequiredDetails
TextTextYesThe percent-encoded text to decode.

Outputs

NameTypeDetails
ResultTextThe decoded text.
Need more help?
Can't find what you're looking for? Our team is happy to help.