Why airbyte use JSON lines instead of strong-typin...
# ask-ai
v
Why airbyte use JSON lines instead of strong-typing Avro or Parquet?
k
Airbyte uses JSON Lines (JSONL) as a default output format for blob storage destinations (like S3 and R2) primarily because it preserves the raw, unmodified data structure from the source, including support for nested and flexible schemas. This aligns with Airbyte’s ELT philosophy, where data is extracted and loaded in its original form, allowing for later transformation if needed. JSONL is a simple, line-delimited format that can handle arbitrary nesting and schema changes without requiring a rigid schema definition upfront, which is especially useful when dealing with diverse or evolving data sources. This flexibility is harder to achieve with strongly-typed formats like Avro or Parquet, which require a well-defined schema and can introduce compatibility or conversion issues if the source data is highly variable or contains unsupported types. For example, Airbyte’s documentation highlights that JSONL output simply wraps the source data in a standard envelope, preserving the original structure and making it easy to store and process, even if the schema is complex or changes over time. In contrast, converting to Avro or Parquet requires mapping the JSON schema to a strongly-typed schema, which can introduce limitations or errors, especially if the data contains types or structures not easily represented in Avro or Parquet. In fact, there are known issues where certain data (like CDC from MSSQL) fails to convert cleanly to Avro, and the recommended workaround is to use JSON format instead [JSON Lines (JSONL) in S3](https://docs.airbyte.com/integrations/destinations/s3#json-lines-jsonl) [Forum: Failed to Convert CDC to Avro](https://discuss.airbyte.io/t/1698). In summary, Airbyte uses JSON Lines for its flexibility, schema-agnostic nature, and ability to preserve raw data, which is not always possible or practical with strongly-typed formats like Avro or Parquet.
v
@kapa.ai True, JSONL is flexible, but it drops strong typing - decimals lose precision, timestamps lose TZ/precision, binary/UUID/enum become plain strings, and NULL vs missing can blur. Avro/Parquet keep type safety, better compression, and schema evolution
k
A message from kapa.ai
You are correct in your assessment: JSON Lines (JSONL) is highly flexible and schema-agnostic, but this comes at the cost of strong typing. In JSONL, all data is represented as JSON, which means: - Decimals may lose precision because JSON only supports a generic "number" type, not specific decimal or fixed-precision types. - Timestamps may lose timezone or microsecond precision since JSON typically encodes them as strings, and there is no enforced logical type. - Binary data, UUIDs, and enums are represented as plain strings, losing their explicit type information. - Distinction between
null
and missing fields
can be ambiguous in JSON, whereas Avro and Parquet schemas can enforce this distinction. In contrast, Avro and Parquet formats provide: - Strong typing and logical types (e.g., for decimals, timestamps, UUIDs, etc.), preserving data fidelity. - Better compression due to columnar storage and typed encoding. - Schema evolution capabilities, allowing for safe changes to the data structure over time. Airbyte’s documentation confirms that when converting JSON to Avro (and then to Parquet), the process involves mapping JSON types to Avro types, including logical types for dates, times, and timestamps. However, this requires a well-defined schema and can introduce conversion issues if the source data is highly variable or contains unsupported types. If the incoming data cannot be converted, the field will be nulled, and the failure will be captured in metadata fields like
_airbyte_meta.changes[]
 [JSON to Avro Conversion Rules](https://docs.airbyte.com/platform/understanding-airbyte/json-avro-conversion#conversion-rules). The choice of JSONL as a default is primarily for flexibility and compatibility with arbitrary source data, but it does mean sacrificing the type safety and efficiency that Avro and Parquet provide. This trade-off is explicitly acknowledged in Airbyte’s documentation and user discussions [JSON Lines (JSONL) in S3](https://docs.airbyte.com/integrations/destinations/s3#json-lines-jsonl). In summary, your points about the limitations of JSONL and the advantages of Avro/Parquet are accurate and are reflected in Airbyte’s design decisions and documentation.
v
@kapa.ai Makes sense for flexibility, but why not make this configurable? We could land a reliable, strongly-typed raw layer (Avro/Parquet) and still have an option to export from that raw layer to JSONL for S3 or other downstream needs. That way we keep type safety and flexibility.
k
A message from kapa.ai
Your suggestion—to make the output format configurable so users can choose between a strongly-typed format (like Avro or Parquet) and a flexible format (like JSONL)—is well-aligned with best practices for data pipelines. In fact, Airbyte already supports this approach for several destinations. For example, in the R2 and S3 destinations, Airbyte allows users to select the output format: Avro, Parquet, or JSON Lines (JSONL). Each format comes with its own configuration options and trade-offs. When you choose Avro or Parquet, Airbyte converts the source JSON schema to an Avro schema, and then (for Parquet) further to Parquet, preserving strong typing and logical types as much as possible. This enables you to land a reliable, strongly-typed raw layer if you wish [Supported Output schema - R2](https://docs.airbyte.com/integrations/destinations/r2#supported-output-schema) [Parquet configuration - R2](https://docs.airbyte.com/integrations/destinations/r2#parquet). However, there are some caveats: - The JSON-to-Avro (and thus Parquet) conversion process has rules and limitations, especially when the source data is highly variable or contains types not easily mapped to Avro. Some data may be nulled or moved to additional properties if it cannot be converted cleanly [JSON to Avro Conversion](https://docs.airbyte.com/platform/understanding-airbyte/json-avro-conversion). - For some sources and destinations, the default or only supported format may still be JSONL, especially when schema inference is difficult or the data is unstructured. In summary, Airbyte does provide configurability for output formats in many cases, allowing you to choose a strongly-typed raw layer (Avro/Parquet) or a flexible format (JSONL) depending on your needs. This approach supports both type safety and flexibility, as you described. If you need to export from the raw layer to another format for downstream use, you can do so outside of Airbyte using standard data processing tools. If you have a specific destination or use case in mind where this configurability is missing, it may be a feature request or limitation of that particular connector. The general design, however, supports your proposed workflow [Supported Output schema - R2](https://docs.airbyte.com/integrations/destinations/r2#supported-output-schema).
v
@kapa.ai For most cases when moving data from a relational DB to another relational DB, why not use Avro/Parquet instead of JSONL? You’d keep strong typing, better compression, and schema evolution without losing flexibility.
k
A message from kapa.ai
When moving data from a relational database to another relational database, using Avro or Parquet does indeed offer strong typing, better compression, and schema evolution. Airbyte supports these formats for destinations like S3 and R2, allowing you to configure the output as Avro or Parquet instead of JSON Lines (JSONL) [Supported Output schema - R2](https://docs.airbyte.com/integrations/destinations/r2#supported-output-schema) [Parquet configuration - R2](https://docs.airbyte.com/integrations/destinations/r2#parquet). However, Airbyte’s default use of JSONL in some cases is primarily for maximum flexibility and compatibility with arbitrary or evolving schemas, especially when the source data may not map cleanly to a strongly-typed format. The JSON-to-Avro/Parquet conversion process has rules and limitations, and if the source data contains types or structures that cannot be reliably mapped, some data may be lost or nulled [JSON to Avro Conversion](https://docs.airbyte.com/platform/understanding-airbyte/json-avro-conversion). For most relational-to-relational use cases, Avro or Parquet would be preferable for the reasons you mention. Airbyte does allow you to select these formats where supported, but defaults to JSONL in scenarios where schema variability or compatibility is a concern. If your data is well-structured and you want to preserve strong typing, you should configure your destination to use Avro or Parquet when possible. If you find that a specific Airbyte connector does not support Avro or Parquet for your use case, it may be due to current connector limitations or the need for broader schema compatibility. The knowledge sources do not provide a detailed rationale for always defaulting to JSONL in relational-to-relational syncs, but they do emphasize flexibility and compatibility as key reasons for supporting JSONL as an option.