Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including dtl-js with all npm packages installed. Try it out:

const DTL = require('dtl-js'); let input_data = { "first_name": "Dominique", "last_name": "Wilson", "birth_year": 1984, "birth_month": 11, "birth_day": 22, "id": 1821002, "location": { "code": "CO7", "description": "westminster south" }, "primary_email": "dominiquew@example.com" }; // let template = { "name": { "first": "(: $first_name :)", "last": "(: $last_name :)", "full": "(: &( $first_name ' ' $last_name ) :)" }, "email_address": "(: $primary_email :)", "group": 172, "importer": "automated_data_importer", "age": "(: num( strftime('%Y' now()) ) - $birth_year :)", "dob": "(: &( $birth_year '-' $birth_month '-' $birth_day) :)", "identifier": "(: &( $location.code '_' $id ) :)" }; let result = DTL.apply(input_data, template); console.log(result);

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

dtl-js v5.0.4

Data Transformation Language - JSON templates and data calculations

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free