Azure Data Factory :Reading a Json document with each line being a complete json

Ankit Kumar 71 Reputation points
2021-12-20T17:07:57.587+00:00

I have file which I generate in using Dataflow in ADF that is something like this

{"BaseObject":"ABCD","OHY":"AAS"}
{"BaseObject":"DEFG","OHY":"LOI"}
{"BaseObject":"POIU","OHY":"JJI"}

If you see here, I have each line as complete JSON, now my next step is to use each value of BaseObject from each line and pass it to other activity in the same pipeline. How can I do this??

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
0 comments No comments
{count} votes

Answer accepted by question author
  1. svijay-MSFT 5,256 Reputation points Microsoft Employee Moderator
    2021-12-21T18:00:31.3+00:00

    Hello @Ankit Kumar ,

    Thanks for the question and using MS Q&A platform. From my understanding, you would like to iterate through baseobject for each line. You could follow the below approach.

    159397-image.png

    STEP 1: You could use the lookup activity to read lines. If you have it in variable, you could directly consume values by skipping the STEP 1 & STEP 2

    STEP 2: Set the source and uncheck first row only

    **STEP 3: ** You could add a foreach activity to iterate through the each line.

    **STEP 4: ** You could add the below expression under the setting of the foreach activity.

    @activity('Lookup1').output.value  
    

    STEP 5 : I have used Set Variable activity, but you could use any other activity and iterate through each base object value by using the below expression

    @item().baseobject  
    

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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