@Nithin Vanam As per the screenshot the file that is created has the below content which is incorrect json therefore the error is expected. If you see the below file then it has a single element of json per line and while parsing the single line text content should work as expected. But if you want to parse the full content of the file then you need to convert it to array and then parse.
{"SEASON":2020, "BOOKING_NO":100024,"COMPONENT_NO":500034, "VERSION_NO":9,"TOTAL_GROSS_AMT":7163.5, "TOTAL_COMM_AMT":0.0,"TOTAL_NET_AMT":7163.5,"PAYMENT_AMT":5.5, "BALANCE_AMT":7158.0,"BALANCE_DATE":"2020-05-31T00:00:00","EX GRATIA AMT":0.0, "CREATED BY":"1leung", "CREATED DATE":"2020-04-20115:31:43", "DISCOUNT AMT":0.0,"COMPONENT STATUS":"I","TERMINATION_CODE":"13","UNIQUE_KEY": "5000342020"}
{"SEASON":2020, "BOOKING_NO":100024,"COMPONENT_NO":500034, "VERSION_NO":9,"TOTAL_GROSS_AMT":7163.5, "TOTAL_COMM_AMT":0.0,"TOTAL_NET_AMT":7163.5,"PAYMENT_AMT":5.5, "BALANCE_AMT":7158.0,"BALANCE_DATE":"2020-05-31T00:00:00","EX GRATIA AMT":0.0, "CREATED BY":"1leung", "CREATED DATE":"2020-04-20115:31:43", "DISCOUNT AMT":0.0,"COMPONENT STATUS":"I","TERMINATION_CODE":"13","UNIQUE_KEY": "5000342020"}
{"SEASON":2020, "BOOKING_NO":100024,"COMPONENT_NO":500034, "VERSION_NO":9,"TOTAL_GROSS_AMT":7163.5, "TOTAL_COMM_AMT":0.0,"TOTAL_NET_AMT":7163.5,"PAYMENT_AMT":5.5, "BALANCE_AMT":7158.0,"BALANCE_DATE":"2020-05-31T00:00:00","EX GRATIA AMT":0.0, "CREATED BY":"1leung", "CREATED DATE":"2020-04-20115:31:43", "DISCOUNT AMT":0.0,"COMPONENT STATUS":"I","TERMINATION_CODE":"13","UNIQUE_KEY": "5000342020"}
As I can see the one json element is in a single line of your text file so the best would be to convert your text using replace \n
with the ,
and adding the array braces [(yourcontent)]
.
So in my workflow, I am initializing the variable and replacing the content, and creating the array of JSON elements so it has the right content for Parse Json
action.
Code View for initializing variable input
"Initialize_variable": {
"inputs": {
"variables": [
{
"name": "input",
"type": "string",
"value": "[@{replace(body('Get_blob_content_using_path_(V2)'),'\n',',')}]"
}
]
}
Note: When you specify \n and save the workflow then in code view it will be \n as it is expected behaviour as it treats as \n i.e. text rather than new line but for newline you need to remove extra \ from code view.
In the schema, I have used the below formatted text that is the right JSON to generate the schema.
[{"SEASON":2020, "BOOKING_NO":100024,"COMPONENT_NO":500034, "VERSION_NO":9,"TOTAL_GROSS_AMT":7163.5, "TOTAL_COMM_AMT":0.0,"TOTAL_NET_AMT":7163.5,"PAYMENT_AMT":5.5, "BALANCE_AMT":7158.0,"BALANCE_DATE":"2020-05-31T00:00:00","EX GRATIA AMT":0.0, "CREATED BY":"1leung", "CREATED DATE":"2020-04-20115:31:43", "DISCOUNT AMT":0.0,"COMPONENT STATUS":"I","TERMINATION_CODE":"13","UNIQUE_KEY": "5000342020"},
{"SEASON":2020, "BOOKING_NO":100024,"COMPONENT_NO":500034, "VERSION_NO":9,"TOTAL_GROSS_AMT":7163.5, "TOTAL_COMM_AMT":0.0,"TOTAL_NET_AMT":7163.5,"PAYMENT_AMT":5.5, "BALANCE_AMT":7158.0,"BALANCE_DATE":"2020-05-31T00:00:00","EX GRATIA AMT":0.0, "CREATED BY":"1leung", "CREATED DATE":"2020-04-20115:31:43", "DISCOUNT AMT":0.0,"COMPONENT STATUS":"I","TERMINATION_CODE":"13","UNIQUE_KEY": "5000342020"},
{"SEASON":2020, "BOOKING_NO":100024,"COMPONENT_NO":500034, "VERSION_NO":9,"TOTAL_GROSS_AMT":7163.5, "TOTAL_COMM_AMT":0.0,"TOTAL_NET_AMT":7163.5,"PAYMENT_AMT":5.5, "BALANCE_AMT":7158.0,"BALANCE_DATE":"2020-05-31T00:00:00","EX GRATIA AMT":0.0, "CREATED BY":"1leung", "CREATED DATE":"2020-04-20115:31:43", "DISCOUNT AMT":0.0,"COMPONENT STATUS":"I","TERMINATION_CODE":"13","UNIQUE_KEY": "5000342020"}]
There can be other multiple ways of making your content to the right JSON format like looping through your content or splitting to array etc.
Feel free to get back to me if you need any assistance.