<@U04S8PLJWMT> I am syncing from an sftp source th...
# ask-ai
c
@kapa.ai I am syncing from an sftp source that has json files. But the json data is not New lines, rather it has an outer layer, with a list of records inside. The file connector is seeing it as a single line causing issues in the sync. What would you recommend?
k
When syncing JSON files from an SFTP source using Airbyte, the File connector expects the data to be in a supported format. For JSON, there are two common structures: 1. JSON Lines (JSONL): Each line is a separate JSON object. 2. Standard JSON Array: The file contains a single JSON array with multiple objects inside. From your description, your file is a standard JSON array (e.g.,
[{"a":1}, {"a":2}]
), not JSON Lines. Some connectors and tools expect JSONL, and may treat a JSON array as a single record, which causes the issue you’re seeing. Recommendations: - Check File Format Support: The Airbyte File connector does support JSON files that are arrays of objects, not just JSONL. However, if you are using a connector or configuration that expects JSONL, it may misinterpret the file as a single record. Make sure you select the correct file format ("JSON", not "JSONL") when configuring your source connector. If you select "JSON", Airbyte should parse the array and treat each object as a record, as per the documentation for the File source connector [File (CSV, JSON, Excel, Feather, Parquet)](https://docs.airbyte.com/integrations/sources/file#file-csv-json-excel-feather-parquet). - Connector Limitations: If you are using a connector that only supports JSONL (such as some S3 or SFTP connectors), you may encounter this limitation. In that case, you would need to convert your JSON array file to JSONL format, where each object is on its own line. - Workaround: If conversion is possible, you can preprocess your files to convert the JSON array into JSONL before syncing. For example, a file like:
Copy code
json   [     {"a": 1},     {"a": 2}   ]
would become:
Copy code
{"a": 1}   {"a": 2}
- File Connector Configuration: Ensure you are using the latest version of the File connector, as there have been improvements and bug fixes related to JSON array handling in recent releases [Changelog](https://docs.airbyte.com/integrations/sources/file#changelog). If you are still experiencing issues after confirming the above, please provide more details about the connector version and configuration, as there may be a bug or a specific limitation in the connector you are using. Summary: - Use the "JSON" file format in the File connector for JSON arrays. - If only JSONL is supported, convert your file to JSONL. - Update to the latest connector version if possible. If you need more specific guidance, please share your connector configuration and Airbyte version.