Two developers are sitting with their backs to the camera, working on computers in an office environment.
Blog

Trees4Travel system - benefits and use cases of JSON Editor

6
min read
December 23, 2025
Down arrow button

Home > 

Blog >  

  > 

Web applications frequently rely on storing and processing data entered through forms. These are typically used in predefined scenarios, where the backend application expects specific data from specific API requests. Predefined forms fulfill the needs of the majority of their use cases, because the data structure, such as database models, doesn't change on the fly.

Client introduction

Trees4Travel works with travel brands around the world in the business and leisure sectors to provide carbon management technology. The company's systems help calculate and reduce emissions impacts. Trees4Travel makes it simple to positively impact the climate through direct integration with booking systems, API connectivity or simple file transfer. The company educates travelers and provides the necessary transition tools to move us from where we are today to our net zero goals in the future - making travel and events more ethical and sustainable.

The problem

But what if there was a need to process data, whose structure cannot be predicted and is too complex to keep it in a simple key-value list? Trees4Travel system encountered such an issue.

Assume a marketing system, with a list of contacts and email templates. The goal is to define the content of an email message and a list of recipients to receive it. The email templates use Handlebars - a templating language used to define how a template should parse input data into output message. Most frequently it consists of defining variables in a "moustache" format such as "Dear {{firstName}}". However, There are more advanced features such as conditional content, looping over arrays, formatting variables, and even custom user-defined parsers. As result, each email template will have its unique set of input parameters, often consisting of arrays and nested objects.

Now, back to our problem - We need to fill in the content of such email templates, store it in the system and have it sent (periodically) to selected contacts. How can we achieve this?

Introduction to JSONEditor

Instead of reinventing the wheel, we can get assistance from external packages and modules. In this example we will be taking a look at a javascript tool called JSONEditor. The premise is simple: The user provides a json schema which defines the structure of the form and the input/output data. This tool provides all the features we need to define our form: Text-based fields, dropdown lists, conditional fields, arrays, nested fields, support for rich text editors, file upload and so on. The diagram below demonstrates how it works.

A diagram showing a data flow from a JSON schema to an HTML form, and then to a final JSON output.

Initializing JSONEditor inside your div element is really simple as shown below. Among various configuration fields we can choose a CSS theme from several existing ones, or we can use a barebones theme and manually style the look of the form.

A screenshot of a JavaScript code snippet. The code defines an "editorOptions" object that disables several features of a JSON editor, and then uses these options to create a new "JSONEditor" instance.

Now, we simply need to provide a JSON schema for each email template to define each editable field, then use the dynamically generated form to fill in the data, store the result in JSON format (so that we can save it in the database to use or edit it later) and then use Handlebars to fill in the email template with our form values. How does this look in practice? Let’s look at an example from Trees4Travel marketing system.

First, our system loads a list of email templates directly from SendGrid, meaning that at any point in time we can edit these templates and have them immediately updated in the system.

A screenshot of a dropdown menu in a software interface, with the "Customized message" option highlighted as the selected choice.

Once we’ve made our choice, let’s look at the raw template. This is a simple example, but we can see several handlebars variables, such as {{firstName}} and {{buttonText}}.

A screenshot of an email template for "Trees4Travel." The template shows placeholders for the subject and body, a logo, and a main image of a heart-shaped island covered in trees, viewed from above.

‍

Let’s write a schema to generate a form for editing this template. We can do it directly in the system, which saves the schema in the database.

A screenshot of a JSON schema that defines an object with properties for an email template, including topic, recipient name, body message, and button details. Below the code, there are "CONFIRM" and "CANCEL" buttons.

This schema defines the form that will generate a JSON result used to fill in the contents of our marketing email. Each field has a name, a type and optionally a title and format.
Here, we are using 3 types of fields: A simple text field, an “xhtml” text field which will be displayed as a rich text editor in the form, and a boolean true/false field.


Finally, here is a working example of the form with a live preview of how the email will look like when parsed.

A split-screen view of an email marketing editor. The left panel shows the content fields being edited, and the right panel displays a live preview of the email, including a "CLAIM GIFT" button and a heart-shaped island image.

Our system goes a step further and detects some variables such as first name and replaces them with the name of the actual recipient. We can send this email to many contacts at once and each one will have their own name on it.

A split-screen view of an email editor. The left panel shows the "FIRST NAME" input field, while the right panel displays the live email preview where the name "Mateusz" is dynamically rendered.

We also use a similar system for defining the contents of a personalized forest page. Let’s look at an example that generates a more interesting form which defines an array where each entry is a monthly reforestation update consisting of: a time period, a rich text entry, a photo and optionally a video.

First, the schema:

A JSON schema defining the data structure for reforestation updates, including an array of entries with periods, descriptions, and photos.

Here, we have a simple header text and an array type. The “items” field defines the format of each array entry. Nested inside are fields per each entry. The interesting one is certainly the photo field, as it uses a file upload control. In order for this to work we need to set up a couple things beforehand. First, you can see we are using an “upload_handler”. We need to define the way it actually uploads the file:

A JSON schema defining the data structure for reforestation updates, including an array of entries with periods, descriptions, and photos.

The code above defines our “defaultUploadHandler” which uses a FileReader to read the contents of the file in Base64 format and then uses a post request to send the file to our server:

A single-line code snippet showing a TypeScript function named uploadCustomContentFile that takes a base64file: string as an argument and returns a Promise<string>. The function's body makes a this.post call to an API endpoint.

How exactly a file is stored on the server is up to implementation, but we chose to store them in an Azure blob storage. The above request returns the url from our API pointing to the newly stored file which is then passed back to our form. This is important because it means we never actually store the whole file in the form’s JSON result - instead we only save the resulting url to where the file is stored on our blob storage.

A screenshot of a content management system (CMS) interface for a project entry dated "April 2023." The page shows an editable description of a reforestation project along with fields for a photo and a YouTube video URL

First, we can see the file upload control which works exactly as we would expect - we pick a file, we upload it and that’s it - the resulting image URL is already stored in the form.

We can also see the array management in action. In the left column we see a list of entries. Using the buttons on the top and bottom we can add, delete, rename and reorder entries any way we want - it’s very flexible. In order to actually iterate over the resulting JSON array we need to use the #each keyword of handlebars.

 A Handlebars code snippet showing a loop. It iterates over a collection named entries and repeats the HTML content inside the <div> for each entry.

This let’s us easily keep our reforestation page up to date

A page from a reforestation project report. The section for "April 2023" includes a photo collage showing a man standing next to a young tree and a team of people planting on a hillside.

Workflow efficiency with JSONEditor: advantages and limitations

To summarize, let’s see how dynamic forms, specifically using JSONEditor can aid us in our work, but also when it is not advised to use them. There are obviously many advantages. Thanks to this tool and the way it was implemented in the system we can:

  • Set up our forms on the fly
  • Instantly generate the result of a form and use it to display parsed content
  • Add support for new message templates without having to rebuild or republish the whole project
  • Easily add or remove fields while maintaining compatibility with already existing JSON data generated by those forms

However, it is important to note that JSON results, while easy to store in the database and use within this editor, are rather difficult to work with outside of those use cases for manual modifications. And while this tool is quite flexible with what we can achieve, using it solely for the purpose of writing blog-post style updates where each one uses the same form layout would almost certainly be considered style over substance, especially when most CMS systems would prove much better for this task.

That having said, the above example of marketing emails is the perfect candidate for this tool as it relies heavily on frequent editing of the forms, the need to see results immediately, flexibility of the input/output data and the ability to store the results in JSON format in the database in order to set up cyclic marketing content.

FAQ
What is JSONEditor and how does it work?
Arrow down

JSONEditor is a JavaScript tool that generates dynamic forms based on a JSON schema. The schema defines the structure of the form, including fields, arrays, nested objects, and input types. The user fills in the form, which produces a JSON result that can be stored or processed in backend systems.

‍

Why use JSONEditor instead of a standard CMS for forms?
Arrow down

JSONEditor is ideal when the structure of data cannot be predicted or is complex. Unlike CMS forms, it allows dynamic, nested, and conditional fields, supports rich text editors, file uploads, and arrays, making it suitable for tasks like generating personalized emails or reforestation updates.

‍

How does JSONEditor integrate with email templates?
Arrow down

A JSON schema defines the editable fields for an email template (e.g., {{firstName}}, {{buttonText}}). The editor generates a form to fill in these values, which are stored in JSON format. Handlebars then parses the data into the email template, allowing personalized messages to be sent to multiple recipients.

‍

Can JSONEditor handle file uploads and complex data arrays?
Arrow down

Yes. File fields can be linked to upload handlers (e.g., sending files to Azure blob storage). Arrays and nested objects can be managed directly in the form, allowing users to add, delete, reorder, and update entries dynamically, all stored as JSON.

‍

What are the advantages and limitations of using JSONEditor?
Arrow down

Advantages: rapid form setup, instant generation of structured data, flexible addition/removal of fields, easy support for new templates without full redeployment.
Limitations: JSON data is harder to modify manually outside the system, and it is less suited for repetitive, blog-style content where a CMS would be more efficient.

‍

About The Author
Mateusz, an experienced .NET developer, specializes in backend development
Mateusz Sacha
LinkedIn

Mateusz is a .NET developer with over six years of experience building reliable backend systems using ASP.NET, Razor and Entity Framework. He has hands-on experience managing application deployments and cloud infrastructure in Azure, ensuring smooth releases and stable environments. While his main focus is backend development, he’s also comfortable stepping into Angular when needed to keep projects running smoothly.

See all our authors

STAY AHEAD OF THE CURVE

We monitor industry trends and implement cutting-edge solutions. Explore our services.

Discover more

Strategic insights into technology, software development, and digital growth

Microsoft Solutions Partner badge for Data and AI (Azure)

Microsoft Solutions Partner - what the status actually verifies

Not all vendor badges are created equal. Discover what the Microsoft Solutions Partner designation actually verifies - from team skilling to proven client outcomes - and why legacy "Gold" status no longer guarantees current expertise

 A person is seated with their back to the camera, working with a large monitor and two laptops on a desk.

AI in Programming: ChatGPT, GitHub Copilot and Alternatives

Explore the real impact of AI tools like ChatGPT and GitHub Copilot on programming efficiency. Compare their strengths, limitations, and alternatives like Tabnine and Claude.ai to see how they enhance coding workflows.

Two computer monitors on a wooden desk show different design layouts. A keyboard, trackpad, and cat figurine are on the desk.

Website development: CMS versus classic programming

Discover the advantages and disadvantages of CMS blockchain systems versus classic programming in website development. Explore popular CMS options like WordPress, Shopify, Bubble, and Webflow, and learn when to choose classic programming

 A close-up, macro shot of a black electronic circuit board with many small components and microchips.

Use of .NET in embedded systems programming

Develop software for embedded systems using .NET with nanoFramework. Learn how to leverage C# for microcontrollers like ESP32 to build applications, like a weather station measuring temperature, pressure & humidity.

 A young woman is interacting with a futuristic, holographic user interface, pointing at a circular graphic with her finger.

Technology Trends Guide 2024: What's Next?

Explore the trends shaping the future in 2024, from AI, IoT, and Blockchain breakthroughs to sustainability and the digital health revolution. Learn how IT outsourcing can be your key to adaptation, providing access to expert specialists.

 Two developers are sitting with their backs to the camera, working on computers in an office environment.

Trees4Travel system - benefits and use cases of JSON Editor

Web applications frequently rely on storing and processing data entered through forms. These are typically used in predefined scenarios, where the backend application expects specific data from specific API requests.

 A person's hands are typing on a laptop with a screen full of code. Another laptop with a website is nearby.

Contentful - Empowering content creation and management

Unlock content creation efficiency with Contentful, a flexible and scalable CMS. Explore its seamless integration, AI-based model generation, and versatile support for various content types.

 A close-up of a laptop screen showing the welcome page for Power Pages, a Microsoft product, with a purple, stylized graphic

Microsoft PowerPages: The future of application development

Delve into Microsoft's promotion of PowerPages, its integration with the Microsoft ecosystem, and its aim to simplify application development for non-programmers. Follow SKM Group's journey in testing PowerPages and revealing encountered problems.

 A purple-themed graphic showing the Angular logo, a lightning bolt, and the ASP.NET Core logo.

Building web applications: Blazor vs. Angular

Has the moment arrived for us to relegate Angular to the past and unanimously transition to Blazor? Or perhaps, could it be that Blazor, as the successor to Razor, is afflicted from the same issues as its predecessor?

 A person in a blue shirt is typing on a keyboard, looking at a large computer monitor that displays lines of code.

Effective Interface Localization - Practical Guidelines

In the current digital world, reaching a global audience is essential. Translations break language barriers and make users feel at home. However, managing translations isn't easy.

 A close-up of a laptop screen displaying lines of CSS code.

Introduction to Blazor: A new era of web application

In recent times, Blazor has become a highly popular technology in the field of web application development. Due to its increasing popularity, we decided to explore its practical implementation.

Comments

Pavel Brown
July 9, 2023

Exciting! Could you tell me how the JSON editor mixes with other tools?

Write a comment:

Oops! Something went wrong while submitting the form.