Importing and Parsing Data
Using data defined outside of Stof.
Last updated
Was this helpful?
Using data defined outside of Stof.
Last updated
Was this helpful?
The vast majority of data in the world is not defined as Stof (shocking, I know). Stof is not the standard and never will be. Rather, Stof works with all other data formats so that you can work with data in the form you prefer (or the form it's already in).
Stof Formats are dynamic and extensible, allowing users to import, export, and parse data in a wide variety of forms.
The simplest way to show this is with the . Any format that is loaded into the document can be used to parse data into a document.
is a popular configuration file format and comes baked into Stof by default. In this example, we'll import a TOML document and add an interface to it with Stof.
Using the same interface we defined in JSON to Stof, we can use the same data in a different form (TOML instead of JSON).
Using the , we can run this document, resulting in the same output as before:
Additional files and the import statement are not the only way data can enter a document. The parse function in the is a very powerful additional way to do this. Stof can even parse in additional Stof programmatically with the parse function, enabling documents to parse in remote data interfaces.