How to delete " from JSON file (at the beginning after [ and at the end before ] )

Anonymous
2022-01-13T01:00:47.33+00:00

I am trying to get rid of two double quotation marks from this JSON file.

Bottom is image:
164508-image.png

This is text. I am sharing my JSON file here.

[" { "GLDETAIL": { "RECORDNO": "249125-1688259-784668--accrual", "BATCH_DATE": "01/01/2022" } }, { "GLDETAIL": { "RECORDNO": "249125-1688260-784669--accrual", "BATCH_DATE": "01/01/2022" } },"]

I have a "Replace" function within my pipeline as illustrated below:
164517-image.png
This is details:
Basically, I am trying to get rid of '\r\n' and ' \ '.

This is the whole dynamic statement:

@replace(replace(string(activity('**Web1').output.output),'\r\n',''),'\','')**

It worked to replace these two characters, but now, I am trying to understand how " was automatically created at the beginning and at the end (inside [ ] ) and I am trying to delete those two quotation marks.

This is original text that I have before this dynamic function is applied to get rid of '\r\n' and ' \ '.
[
"\r\n {\r\n \"GLDETAIL\": {\r\n \"RECORDNO\": \"249125-1688259-784668--accrual\",\r\n \"BATCH_DATE\": \"01/01/2022\"\r\n }\r\n },\r\n {\r\n \"GLDETAIL\": {\r\n \"RECORDNO\": \"249125-1688260-784669--accrual\",\r\n \"BATCH_DATE\": \"01/01/2022\"\r\n }\r\n }\r\n,"
]

164509-image.png

How do I go about doing it (deleting " after [ and " before ] )?

Thank you.

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

Accepted answer
  1. svijay-MSFT 5,201 Reputation points Microsoft Employee
    2022-01-13T15:36:37.137+00:00

    Hello @KingJava,

    Thanks for the question and using MS Q&A platform.

    You could use the below expression :

    @concat('[',substring(replace(replace(string(variables('var')),'\r\n',''),'\',''),add(indexof(replace(replace(string(variables('var')),'\r\n',''),'\',''),'"'),1),add(lastindexof(replace(replace(string(variables('var')),'\r\n',''),'\',''),'"'),-1)) ,']')  
    

    The idea is to make get the substring between first index of " and last index of " that you want to get rid of.

    You could replace variables(var) with the webactivity output of yours.

    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

0 additional answers

Sort by: Most helpful