Introducing DJson: A Flexible New PHP Library for Dynamic JSON Templating

DJson is a PHP library designed to simplify dynamic JSON generation across multiple projects. Instead of hard-coding structures in different codebases, you maintain one central library and manage the output through editable templates in your admin panel. Originally built for e-commerce, DJson helps keep JSON consistent, flexible, and easy to update.

Today I’m excited to introduce DJson, a PHP library I built to solve a recurring challenge I was facing in several projects: constantly updating and synchronizing JSON structures across different codebases. Each change required edits in multiple places, and keeping everything aligned became both time-consuming and error-prone.

DJson was designed to eliminate that problem entirely. Instead of hard-coding JSON structures in multiple systems, you maintain a single, versioned library — and control the actual output through templates that can be edited directly in your admin panel. That means no more patching several repositories just to add a field or adjust a structure. Update a template, and every environment using DJson instantly benefits.

At its core, DJson is a dynamic JSON templating engine for PHP. It lets you define JSON templates with variables, loops, conditionals, and custom functions, giving you a clean and expressive way to generate structured data. While I originally built it for e-commerce needs — product catalogs, pricing, feeds, and JSON-LD - the approach works across many domains. Anywhere JSON needs to be dynamic and centrally maintained, DJson fits naturally.

Although it originated from e-commerce, it’s not limited to it. Developers can use DJson for API responses, CMS integrations, configuration pipelines, document generation, and more. I’m especially excited to see how others adapt it to use cases I haven’t even imagined.

Releasing my first PHP library has been a fun journey - from designing the syntax, to refining the architecture, to launching documentation on djson.dev. It’s still early days, but I’m eager to continue improving it and shaping the roadmap based on real-world feedback.

You can explore the documentation and examples at https://djson.dev. And if you end up using DJson in your own systems, I’d love to hear about your experience.

This is just the beginning - and I’m excited to see how the community builds on it.

Jakub Winkler
Written by

Jakub Winkler

Specialist in optimization and efficiency of store platforms. He has been actively working in the eCommerce industry for 14 years, dealing with the architecture of eCommerce systems and application performance optimization. Founder of the qoliber brand, active developer and author of the bestseller "Mastering Adobe Commerce Frontend". His passion is improving the speed and efficiency of online stores. 

Share by