← All topics

Learn free · topic 60

JSON / XML SCHEMA MODELLING

JSON / XML Schema Modelling is the practice of defining structured schemas for semi-structured data formats such as JSON and XML. These schemas specify the allowed structure, elements, datatypes, and constraints of documents to ensure consistency, validation, and interoperability across systems. Rather than focusing on database storage, this modelling technique focuses on structured data exchange.

The primary goal of JSON / XML Schema Modelling is to provide a clear and enforceable contract for APIs, integration workflows, and document-based systems. When multiple applications exchange data, they must agree not only on the names of fields but also on their structure, required attributes, data types, and validation rules. A schema formalizes these expectations and prevents inconsistent or malformed data from entering the system.

In this approach, schemas define elements, nesting rules, datatypes, required fields, and sometimes value constraints. For example, a Loan schema might define that LoanID is a required string, LoanAmount is a numeric field greater than zero, and Status must be one of a predefined set of values. The schema ensures that every system sending or receiving loan data adheres to the same structural rules.

In a real-world loan approval environment, a bank may expose a Loan API using JSON payloads for mobile applications and partner integrations. At the same time, a regulatory authority may require periodic submissions in XML format. JSON provides agility and developer productivity for modern applications, while XML supports compliance, standards-based exchange, and legacy integration. Schema definitions in both formats ensure that all participants interpret the data consistently.

A JSON representation of a loan might appear as:

  • A LoanID field identifying the loan.
  • A nested Customer object containing CustomerID and Name.
  • A nested Officer object containing OfficerID and Name.
  • Fields such as LoanAmount and Status at the top level.

The equivalent XML representation would structure the same information using nested tags under a root Loan element, preserving the same logical structure but expressed in XML syntax.

JSON and XML schemas offer several strengths. They are human-readable and widely supported across platforms. They enable self-describing documents and structured validation. They are highly effective for integration and interoperability between distributed systems.

However, trade-offs exist. JSON by itself lacks strict typing unless paired with a formal JSON Schema. XML, while powerful and expressive, can be verbose and computationally heavier to process. Neither format is optimized for complex joins or analytical workloads; their primary purpose is structured data exchange rather than relational querying.

Normalization forms do not apply to JSON / XML Schema Modelling because these formats are hierarchical and document-centric rather than relational. While designers may choose to structure documents cleanly and avoid redundancy, this is not governed by formal normal forms.

JSON / XML Schema Modelling excels in scenarios where structured communication matters more than storage optimization. In loan approval systems, it enables consistent data flow between mobile applications, underwriting services, partner institutions, and regulators. It represents a modelling approach centered on interoperability and validation, ensuring that data exchanged between systems carries the correct structure and meaning with minimal friction.

Loan Approval Example

JSON Representation

{

"LoanID": "L001",

"Customer": {"CustomerID": "C101", "Name": "Ali Khan"},

"Officer": {"OfficerID": "O11", "Name": "Ahmed Raza"},

"LoanAmount": 50000,

"Status": "Approved"

}

XML Representation

<Loan>

<LoanID>L001</LoanID>

<Customer>

<CustomerID>C101</CustomerID>

<Name>Ali Khan</Name>

</Customer>

<Officer>

<OfficerID>O11</OfficerID>

<Name>Ahmed Raza</Name>

</Officer>

<LoanAmount>50000</LoanAmount>

<Status>Approved</Status>

</Loan>

Finished reading? Test yourself with 10 questions on this topic.

Go to the questions →

From I Am Datapedia! by Mustafa Qizilbash, published here free by the author. Nothing about your reading is stored.