Working with URLs and Base64
Last updated
Was this helpful?
Last updated
Was this helpful?
When working with external systems nearly all communications will be done through data of . For example, when sending an App Object thrugh an the app Object will typically be encoded as JSON. Airkit provides functions to help encode data as Text for different common use cases.
JSON is a very common for encoding complex data such as or App Objects to Text. The , and functions can encode/decode all types to and from JSON. For example, if we were to encode this library listing to JSON:
the result would be the following JSON
Also note, that JSON is valid Airscript. This makes it very convenient to copy paste JSON into an Expression Editor.
Values of the , , and types encode to JSON as objects, however, external systems will often have unique encodings for these types. See for information about common encodings of Dates and Datetimes.
Values of the type are likely to have different encodings with different external systems. See for information on how to encode a Currency in Text.
When developing a web application it is often useful to embed data in the url of a web page. Search engines will often encode the query in a URL Query Parameter, for example a Google search for airkit has q=airkit at the end of the url: . However, notice that search for the term low code needs special treatment because of the space: . Use the and functions to encode and decode text for use in URLs.
Note, however, that when using an query parameters can be entered separately from the URL, in such a case the parameters will be automatically encoded so the function should not be used.
While JSON is a way to encode more complex data types such as and Objects into , more complex data such as images or video are commonly encoded using Base64. While Airscript cannot directly access the internal data of images or videos, there are scenarios where may need to be encoded or decoded when working with an external system. The and functions can be used in these cases.