ADF - String to Json Array Cast Issue

Tomar, Abhishek 6 Reputation points
2022-03-08T11:57:12.22+00:00

Ho can i remove single item array and just display as normal json string type.

I am trying to get first element from all array and want to display as string but when i'm trying this with derivedColumn1, at function its showing that my columns in not array.

How can i convert my columns in array and get first element.

This is my output.

    {  
      "partition_key": 2031,  
      "npi": 111111,  
      "reporting_entity_name": "ABC",  
      "billing_class": ["professional"],       //REMOVE ARRAY  
      "negotiation_arrangement": "ffs",  
      "description": "sdfs s df sd f sd f sd f sd f sd f",  
      "plan_id_type": ["recon-key"],      //REMOVE ARRAY  
      "expiration_date": [0000000],    //REMOVE ARRAY  
      "plan_name": ["YAO TOMU ROAN"],   //REMOVE ARRAY  
   }  

ERROR
181036-screenshot-2022-03-08-at-52422-pm.png

PIPLINE
180986-screenshot-2022-03-08-at-52107-pm.png

derivedColumn1
181035-screenshot-2022-03-08-at-52145-pm.png

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

1 answer

Sort by: Most helpful
  1. AnnuKumari-MSFT 34,556 Reputation points Microsoft Employee Moderator
    2022-03-09T09:49:57.223+00:00

    Hi @Tomar, Abhishek ,

    Thankyou for using Microsoft Q&A platform and posting your query.

    As I understand your query here is that you want to convert Items of array into string. For that purpose, you are trying to use at function but it's not working as expected in your case. Please correct me if my understanding about your query is wrong.

    I tried to repro your scenario and was able to get the expected output. Alternatively, you can also use expression as : billing_class1 for the same output.
    181434-image.png

    Please validate that the datatype for those columns is an array in the inspect tab of source transformation. If it's not , then the Json is not properly formatted or there is an issue with import schema.

    181441-image.png
    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

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.