AG

JSON Validation

Case Study showing how I optimized JSON Validation in AdTech Holding for internal project

Background

Landing Page Customization & Validation
Empowering users with customizable content and ensuring data integrity

JSON-Powered Customization

Users can modify JSON files to customize features and content of landing pages.

Backend Validation

Before saving changes, the backend validates the JSON against a schema specific to each landing page.

Schema Structure

Schemas are defined in JSON files with a specific structure:

1{
2 "$schema": "http://json-schema.org/draft-07/schema#",
3 // ... other schema properties
4}

Developer Responsibility

Developers are tasked with manually managing and editing dozens of landing page schemas.

Problems

Inconsistent Schema Maintenance
Equivalent parts of the schema differ across landing pages because developers often fail to update and maintain schemas consistently.
Feature Availability Disparity
Business feature availability varies between landing pages, leading to inconsistent user experiences and requiring frequent developer intervention for updates
Complexity in Schema Creation
Developers struggle to create new schemas due to significant differences in existing schemas, making it challenging to understand what needs to be added or modified.

Solution

Adoption of modular JSON schemas maintained by using Zod.

Features are detached and developed as independent modules.
Each landing schema extends business features, ensuring consistent feature availability across all schemas.
During the app build process, Zod objects are transformed into JSON files using the zod-to-json-schema.

The backend then uses such files like the one below to validate client structures.

Impact

Consistency Across Schemas
Modular design ensures uniformity, making schemas predictable and easier to maintain.
Improved Usability
Developers can create and manage schemas more efficiently, reducing time spent on updates and troubleshooting.