Data flow How to remove Null values from sink Json

Vertta Moody 1 Reputation point
2021-10-18T14:35:41.043+00:00

We are using data flow to transform data from CSV to JSON and want to remove null values from an array before writing to a JSON file. All other results that have null values are automatically removed but it seems the null values remain a part of the array. We are pulling three columns into an array, is there a way to remove null values so they are not included in the JSON file.

[case ( length(replace(replace(replace((split(textbox38,':')[2]),'(',''),')',''),'-','')) > 5,
@(Type='Mobile',Number=(trim(replace(replace(replace((split(textbox38,':')[2]),'(',''),')',''),'-',''))))
),

case ( length(replace(replace(replace((split(textbox255,':')[2]),'(',''),')',''),'-','')) > 5,
@(Type='Home',Number=(trim(replace(replace(replace((split(textbox255,':')[2]),'(',''),')',''),'-','')))) ),

case ( length(replace(replace(replace((split(textbox256,':')[2]),'(',''),')',''),'-','')) > 5,
@( Type='Work',Number=trim(replace(replace(replace((split(textbox256,':')[2]),'(',''),')',''),'-',''))) )
]

Data Preview: (this is what is also written to the file, we want the null value removed from the file)

[["Mobile","3334701112"],["Home","4044771234"],null]

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

1 answer

Sort by: Most helpful
  1. MarkKromer-MSFT 5,226 Reputation points Microsoft Employee Moderator
    2021-10-18T22:35:10.527+00:00

    filter(myArray, !isNull(#item))

    1 person found this answer helpful.

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.