0

I ma trying to create json file from SQL table using ADF through Stored Procedure

Stored Procedue:

SELECT ( SELECT * FROM [dbo].[TEST_TABLE] FOR JSON PATH, INCLUDE_NULL_VALUES ) AS json_file;

I am then trying copy activity where Source is SQL Table and Sink is ADLS json but the o/p is coming as

"json_file":"[{"FIL_PATH":"\/mnt\/test\/\/test_table\/jsonfiles","ACTV_IND":"Y","CREATED_DATE":"2024-04-17T20:56:57.870","UPDATED_DATE":"2024-04-17T20:56:57.870","VB_OCCURS":"N"}]"}

I have eevn tried creating as a comma deleimited file instead of json as sink with the below but still it doesn't help

1 Answer 1

1

Not to get added escape characters in Json file you need to sore the data in Json file with delimited file dataset.

My sample stored procedure Output looks like:

enter image description here

To store this into Json file without escape characters you need to use delimited file dataset with below settings:

  • Add column delimiter is the character which is not present in your data.
  • Add quote character and escape character as No quote character and No escape character respectively.

enter image description here

Output:

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Pratik. It worked for the most part except the below. Table data : "/mnt/test/test_table/jsonfiles" Was previously coming as : "\\/mnt\\/test\\/\\/test_table\\/jsonfiles\" but now coming as "\/mnt\/test\/test_table\/jsonfiles\"
Its' due to the fact that when I run the Select Query from the table SELECT ( SELECT * FROM [dbo].[TBL_DATASET_CONFIG] FOR JSON PATH, INCLUDE_NULL_VALUES ) AS approved_dataset it includes the Escape characters. How to get rid of them?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.