Solved

ODX Read multiple json files from same directory

  • 10 October 2023
  • 4 replies
  • 68 views

I’ve a location with multple different json files. Can i use one connector to this directory and transfer each json file, or need i to make one connector for each file?

 

For csv files i can use one connector, for json it doesn’t seem to work this way...

icon

Best answer by rory.smith 10 October 2023, 14:37

View original

4 replies

Userlevel 5
Badge +7

Hi @Pieter-Jan ,

as long as your files are local / cloud storage see: CData ADO.NET Provider for JSON - Establishing a Connection , “Set the URI to a single JSON file or a folder containing JSON files: C:\folder1. Note that specifying a folder results in a single aggregated table derived from all of the JSON files in the folder.”

The files have different format, so i guess this isn’t going to work.

 

for instance, customer.json and order.json in same directory.

Userlevel 5
Badge +7

Hi,

those would have separate structures and therefore need their own .rsd / metadata handling. If the structures nest into each other you might be able to use the MetaDataDiscoveryURI parameter. For XML you point this at an .xsd, I assume you somehow point it at a JSON Schema but have never tried this.

If you have separate files with no common schema, you will most likely need to generate separate .rsd for each table / file. In short: using GenerateSchemaFiles > OnUse, modify them to your needs, add the names of those schemas to Schema > Tables, set GenerateSchemaFiles to Never.

Userlevel 6
Badge +5

Hi @Pieter-Jan 

Rory is correct, if they don’t all follow the format you will need RSD files. If you have multiple versions of each type you can merge them into one table for each type by adding an asterisk in the name for the part to merge. You just need to be sure it ends in .json or has it in the include files field.

Reply