June 5, 2024
Understanding JSON Formats: Objects vs. Arrays
Learn the difference between an array of objects and a nested hierarchy in data modeling.
Understanding JSON Formats: Objects vs. Arrays
When you convert a flat CSV, you typically get a 'Flat Array of Objects'. Each row in the CSV is an object, and all objects are collected into a single array.
The Flat Array Structure
[
{ "id": 1, "name": "Apple" },
{ "id": 2, "name": "Banana" }
]
This is the most compatible format for 99% of data ingestion tasks.
Why You Might Need a Root Object
Some legacy systems or specific API endpoints require the array to be wrapped in a root object:
{
"products": [...],
"metadata": { "count": 2 }
}
While our converter produces the pure array for maximum flexibility, you can easily wrap this output using a simple script or even a text editor.