How to validate JSON field in Azure data factory?

Subedi, Manish 20 Reputation points

I am looking similar isJson function(sqlserver) in Azure data factory dataflow, which can validate if a data value is json format or not?

Is there any such way in ADF to validate if a column data is Json?

Scenario: have a column RETAILER_ITEM_DESC_JSON (created from concatenating multiple columns) which is supposed to be in json format.
Expected result:
If its not in json format, example if we receive double quotes or semicolon in the data file. Then throw it as error
User's image

Thank you!

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
7,974 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Agarwal, Rahul 0 Reputation points

    Here is an example of how you might flag an error when a derived column does not contain proper JSON (using a hypothetical regex to test for JSON):

       !regexMatch(yourColumn, 'your-json-regex-here'),

    Remember to replace 'your-json-regex-here' with an actual regex pattern that matches valid JSON. Note that writing a regular expression to match all valid JSON strings can be extremely complicated, but you might be able to write a simpler one that matches your specific use case.