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):
if(
!regexMatch(yourColumn, 'your-json-regex-here'),
'Error',
yourColumn
)
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.