ADF to search the elements in multiple json files

David Vinh 0 Reputation points
2024-10-20T16:36:56.62+00:00

I have multiple json files and want to search elements in Json files. If found a match, then copy metadata{...} to another storage as json format. I am not able to transform into a sink.

The filter search for record.metada.markings.document.code == 'B' && metadata.publicationDate.date >= '2020-01-01'

{

"record": {

    "ns": "mra",
        "type": "REC",
        "record": {
            "ns": "rec",
            "id": "sample03.json",
            "markings": {
                "document": {
                    "ns": "rec",
                    "code": "B"
                }
            }
		},	
        "metadata": {
			"an": "0002641",
			"markings": {
				"document": {
                "distribution": {
					"code": "B"
					}
				}

				
			},
			"publicationDate": {
				"date": "2024-01-01"
			}
		}

		

		
	}

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

1 answer

Sort by: Most helpful
  1. David Vinh 0 Reputation points
    2024-10-22T22:03:14.3666667+00:00

    dia1

    The source dataset has one of the Json files:

    dia2

    Match the condition requirement in the If Condition activity. then copy the section metadata{...} to sink. It works but it copied the entire JSON file to the sink. I don't know how to copy metadata parent, including children nodes to sink. I want the result json file only have record{ metadata } only in Sink see image:

    dia3

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.