OpenDataGuru
Home › Educational Guides › Data Formats
Data Formats

Choosing Between JSON, CSV, Parquet, and GraphQL for Open Data

Evaluate the engineering trade-offs between flat CSV tables, nested JSON payloads, typed columnar Parquet archives, and flexible GraphQL queries for analytical workloads.

CSV for Universal Simplicity and Tabular Portability

Comma-Separated Values remains the universal lowest common denominator of public intelligence. Almost every spreadsheet editor, database loader, and statistical package ingests CSV natively without specialized drivers, making it ideal for flat census tables, financial ledgers, and ad-hoc journalism.

However, CSV carries no embedded type metadata, struggles with nested arrays or hierarchical metadata, and inflates storage footprint on wide datasets. Pairing CSV files with a Frictionless Data Package JSON schema or W3C CSVW descriptor solves the missing type problem while keeping human readability intact.

  • Best suited for flat relational tables under a few hundred megabytes.
  • Requires explicit schema contracts to protect dates, booleans, and leading-zero IDs.
  • Compresses well with gzip or zstd for archival HTTP transfer.
  • Poor fit for deeply nested provenance trees or multi-polygon geometries.

JSON and JSON Lines for Web APIs and Nested Entities

RFC 8259 JSON is the lingua franca of modern REST APIs because it models nested objects, arrays, booleans, and nulls cleanly. When datasets bundle observation values alongside inline unit definitions, citation arrays, or GeoJSON polygons, JSON preserves structure without awkward denormalization.

For large streaming exports, newline-delimited JSON (NDJSON or JSON Lines) outperforms standard array-wrapped JSON because parsers can process one record at a time with constant memory overhead rather than loading an entire multi-gigabyte bracketed document into RAM.

  • Retains hierarchical nesting, array fields, and explicit null versus empty-string semantics.
  • Avoids CSV delimiter-escaping bugs on free-text descriptions and notes.
  • Higher disk and bandwidth footprint due to repeated key names on every object.
  • Use NDJSON for streaming pipelines exceeding 50,000 records.

GraphQL for Selective Joins and Bandwidth Optimization

Traditional REST endpoints often force clients into over-fetching dozens of unused columns or issuing N+1 follow-up calls to resolve related publisher metadata. A GraphQL endpoint reverses that dynamic by letting the consumer request exact fields and nested relationships in a single strongly typed query.

GraphQL shines when interactive dashboards or lightweight applications query wide datasets with 60+ attributes but only render four metrics. Strong schema introspection also provides built-in developer documentation, though complex arbitrary queries still require query-depth limits on the server.

Apache Parquet for High-Speed Analytical Lakehouses

When open datasets scale into tens of millions of rows—such as historical hourly weather observations or national transit telemetry—row-oriented text formats become CPU and I/O bottlenecks. Apache Parquet stores data in a binary, compressed, columnar layout with embedded column statistics and strict data types.

Columnar projection enables engines like DuckDB, Polars, and Spark to read only the two columns needed for a calculation and skip irrelevant row groups entirely, frequently reducing file sizes by 70% to 85% and speeding analytical scans by an order of magnitude.

Technical Trade-Offs Across Major Open Data Exchange Formats

Format / ProtocolSchema & TypesNested SupportIdeal Scale & Workflow
CSV (RFC 4180)Untyped plain textFlat tables onlyUnder 500 MB; spreadsheets and universal sharing
JSON / NDJSONBasic types (no date type)Native hierarchical treesREST payloads, GeoJSON, and streaming logs
GraphQL APIStrongly typed SDL schemaSelective graph traversalInteractive apps needing exact field subsets
Apache ParquetStrict binary columnar typesNested structs & lists1M+ rows; DuckDB, Polars, and ML feature stores
Frictionless CSV + JSONTabular CSV + JSON schemaFlat with rich metadataAuditable public portals balancing reach and rigor

Use GraphQL or REST JSON for selective live queries and Parquet or compressed CSV for bulk analytical archives.

Worked Illustration: Reducing Pipeline Overhead on a 10M-Row Climate Table

A research lab evaluates downloading and querying a 10-million-row, 18-column historical temperature dataset where their regression script only reads station_id, date, and tmean_c.

  1. As an uncompressed CSV (~1.4 GB), downloading and parsing all 18 columns with type inference takes ~38 seconds of local CPU and disk I/O.
  2. Pulling only the 3 required columns via a GraphQL or column-projected query cuts transferred fields by 83%, though repeated JSON key names remain bulky for 10M rows.
  3. Fetching the same 10M-row archive in Zstandard-compressed Apache Parquet (~210 MB) preserves exact float32 and date32 types natively.
  4. Running a DuckDB columnar scan over just the 3 target columns reads ~42 MB from disk and completes the aggregation in under 1 second.

Worked Illustration Result: Switching bulk historical backfills from raw CSV to columnar Parquet saves ~85% storage and cuts local read latency dramatically, while JSON/GraphQL stays optimal for incremental daily queries.

Data Format Selection Checklist

  • Choose CSV with a companion data dictionary when broad non-technical spreadsheet compatibility is primary.
  • Select NDJSON over array-wrapped JSON when streaming large API exports line by line.
  • Use GraphQL field selection whenever clients only need a small slice of wide entity records.
  • Adopt Apache Parquet for multi-million-row analytical archives queried by DuckDB, Polars, or Spark.
  • Verify explicit ISO 8601 date formatting across all text-based formats to avoid regional ambiguity.
  • Test round-trip type fidelity (nulls, booleans, timestamps, IDs) before locking a production pipeline format.

Frequently Asked Questions

Is JSON slower to parse than CSV for large flat numeric tables?

Yes. Standard JSON repeats every field name on every row, increasing payload size and parser allocation overhead. For large flat tables, compressed CSV or columnar Parquet is much faster.

When does GraphQL beat REST for open data retrieval?

GraphQL excels when an application needs specific metrics joined with publisher metadata across wide schemas, eliminating multiple sequential REST calls and unused field transfers.

Can spreadsheet users open Apache Parquet files directly?

Traditional spreadsheet apps cannot open Parquet natively without plugins, so portals typically offer CSV for spreadsheet analysts alongside Parquet or API endpoints for engineering teams.

How do I prevent CSV files from losing data type definitions?

Publish or maintain a companion JSON Table Schema describing each column's exact data type, format pattern, and null markers alongside the CSV file.

Primary References & Standards

  • IETF RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format
  • Apache Parquet Format Specification: Columnar Storage Layout and Encodings
  • GraphQL Foundation Specification: Type System, Introspection, and Execution

Related Open Data Guides