JSON Format – Combining Objects and Arrays
Real-world applications often contain both single-record information and table-based data on the same page. In JSON, this type of information is represented by combining objects and arrays within a single structure.
-
Data entered in grouped input fields, such as customer information, is typically stored as a JSON object because it represents a single entity. In contrast, table-based data, such as a list of payments or orders, is stored as a JSON array, where each table row becomes a separate JSON object.
This approach keeps related information organized while making the data easy to process through APIs, backend services, databases, and frontend applications. Using meaningful key names and consistent naming conventions, such as camelCase, improves readability and simplifies system integration.
-
The accompanying video demonstrates how to convert a Payment page into a complete JSON structure by storing the Customer Info section as a JSON object and the Payments table as a JSON array. It also explains how table columns become object keys, how multiple rows are represented inside an array, and how different data types, such as text and numbers, should be written correctly in JSON. Finally, it shows how both structures can be combined into a single valid JSON document that accurately reflects the data entered on the page.
