Hi ,
Thanks for reaching out to Microsoft Q&A.
Seems you are attempting to copy data from a DelimitedText (CSV) file to a JSON file in Azure Blob Storage.
Cause
- Column mapping is not supported when copying data between these two formats.
- JSON (V2) expects hierarchical JSON structures, whereas DelimitedText is a flat format.
- The default behavior of JSON (V2) expects to take all source columns as an object or an array rather than mapping them 1-to-1.
Option 1: Remove Column Mapping
- In Copy Data activity, go to the Mapping tab.
- Clear all mappings (Remove explicitly defined column mappings).
- Save and rerun the pipeline.
Option 2: Use JSON Object Mapping
- If you want to structure the data properly in JSON format, modify the sink settings:
- In the Copy Data activity, select the Sink tab.
- Under JSON Format Settings, set File Pattern to 'Array of Objects' (if you want an array format).
- Try using Single Document Output instead of multiple row-based mappings.
- Under JSON Format Settings, set File Pattern to 'Array of Objects' (if you want an array format).
- In the Copy Data activity, select the Sink tab.
Option 3: Use 'JsonFormat' Instead of 'JsonFormatV2'
- If possible, switch the sink format to
JsonFormat
instead ofJsonFormatV2
, asJsonFormat
may allow column mapping (I am not sure on this, need to be checked)
Option 4: Convert CSV to JSON Manually Using Data Flow
If structured JSON is required:
- Use a Data Flow instead of Copy Data.
- In Data Flow:
- Use Source transformation to read the CSV.
- Use a Derived Column transformation to structure data in JSON format.
- Use a Sink transformation with
JsonFormatV2
for hierarchical JSON.
- Use a Sink transformation with
- Use a Derived Column transformation to structure data in JSON format.
- Use Source transformation to read the CSV.
Option 5: Convert to Parquet First (Workaround)
If JSON (V2) does not accept direct CSV transformation:
- Convert the CSV to Parquet format first.
- Then use Parquet to JSON (V2) conversion.
Recommendation
- If your JSON structure is simple, removing column mapping should work.
- If you need a structured JSON format, consider using Data Flow with transformations.
Please feel free to click the 'Upvote' (Thumbs-up) button and 'Accept as Answer'. This helps the community by allowing others with similar queries to easily find the solution.