What is DTL?
You can try it by simply installing it with npm or yarn:
OR you can try right now in your browser below. DTL also includes powerful CLI tools for transforming data in bulk (dtl) and for exploring the syntax (dtlr).
The dtl command line tool is like having all the *nix text tools (like grep, awk, sed, cut etc.) for your complex data structures, and works with JSON, yaml, and csv data.
Finally, the dtlr REPL tool has built-in help and is great for trying things out on the command line.
Try it out!
You can try DTL below. Select an example to auto-fill with sample data and related DTL transform, then click the button to apply the DTL transform. Your result will be displayed in the Result box. (Pro tip: Try editing the transform or input data to change the result.)
Load an example:
DTL is a secure and easy-to-use toolset that lets you define how to manipulate data without writing code. Because DTL has no access to the larger environment, no filesystem access, and no library access, it's a fundamentally safe way to implement complicated data transformations and calculations, even if those calculations come from a third party
Compared to raw code, DTL is more portable, secure, and easy to use. It offers a more secure approach to data manipulation by restricting its access to the larger environment. This feature makes it an ideal choice for developers who need to handle sensitive data or work with data from untrusted sources. Additionally, DTL's portability allows you to put your calculations wherever you need them. They can be transfered between server and browser safely, they can be stored in a database or anywhere that JSON can be stored, giving you maximum flexibility and consistency across your application.
DTL also gives you easy ways to perform complex tasks which would require significantly more complex and potentially bug-prone code. It's grep() function, for example, makes it supremely easy to extract the specific data you're interested in regardless of how complex the rules are to find it.
In short, It's better than raw code because it's portable, secure, and easy to use.
The DTL CLI's versatility and compatibility with multiple data formats, such as JSON, YAML, and CSV, make it an excellent tool for data extraction, transformation, and loading (ETL) tasks. Its CLI tool, dtl, allows you to work with complex data structures as easily as text tools like grep and awk allow you to work with text.
How do I get DTL?
Installing DTL is easy...
To use DTL in your site or browser-based app, simply use the dtl-transform-browser.min.js from the npm package, or include it from the jsdelivr.net CDN:
To use DTL to experiment, you can load the dtlr REPL environment by issuing the following command:
Once the REPL environment is loaded, you can enter the command .help to get general help, or .help followed by the name of a helper function to get help on that function, for example:.help grep will show you the documentation for the grep function.
How do I use it in my code?
To use DTL in your code, simply require the DTL module in your code:
You can browse the DTL npm page for a longer example.
How do I use the dtl CLI tool
The dtl command line tool allows you to apply complex (or simple) DTL transforms to data on the command line without writing any code. It understands JSON, JSONLines, YAML and CSV data for both input and output. Issue the command below for help:
To convert data from yaml to JSON:
To convert data from JSON to yaml:
Take JSON input on stdin, and output YAML on stdout
To extract names from a list of people
More DTL docs
DTL has extensive documentation on its syntax and helpers. You can find information on the expression syntax here and information about the helper functions within DTL in the helper reference. Some docs on some more advanced topics exists. You can also try out dtl and get help in the dtlr command line tool.
Talk to us!
If you would like to chat about DTL and related topics, you can find us on Discord here.
Who made this thing?!?
That'd be mainly this guy, Jay Kuri with a little help from his friends