Reputation: 1147
I have multiple JSON files and use ADF dataflow to exclude the "record" and "contractNumbers" objects, retaining only the {"report":{"metadata":{...}}} objects. However, I am unable to structure the output JSON as expected. What other methods can resolve the problem of excluding unnecessary objects?
{
"record": {
"report": {
"metadata": {
"accessionNumber": "2004",
"reportDate": {
"date": "2025-01-01"
}
},
"contractNumbers": {
"contractNumber": {
"commercial": "ANS1002",
"residental": "CA1191"
}
}
}
}
}
The result will be
{
"report": {
"metadata": {
"accessionNumber": "2004",
"reportDate": {
"date": "2025-01-01"
}
}
}
Upvotes: 0
Views: 45
Reputation: 11454
You can the combination of derived column and select transformations to achieve your requirement.
To select only the required objects from the reports
object, first use a derived column transformation with below expression.
report - @(metadata=record.report.metadata)
Here, this will create an additional column named report
which contains the required objects.
Now, use select transformation with a Rule-based mapping to select only the report
column as shown below. Give the expression as name=='report'
.
Now, you can see the required objects.
You can add your filter transformation for the accessionNumber
before the derived column transformation.
I have used 3 JSON source files, and you can see there are 3 JSON objects in the result JSON file.
Upvotes: 0