Hi Guys,
Has anyone tried to parse a string from JSON that has a "\r" on it? I am trying to get that parsed however it doesnt show up, others without a "\r" parses correctly. Here is the exact Parse value.
And when I try to get the value from it, it comes up as blank.
Other fields work fine.
The expression I am using to get the value for each of those fields would be "items('Apply_to_each')?['SerialNo'] also have tried using ['SerialNo\r] and ['SerialNo%0D" without the quotes. This works for other fields such as so_seqno and orderid (items('Apply_to_each')?['orderid'],
The original format before being parsed to JSON is csv.
Does anyone have any idea on how I could get the value for that specific field?
I think I would convert the JSON to a string (with the string function) replace the \r with nothing and the convert it back to a JSON with the JSON function.
Hi @Paulie78 ,
Thanks for the input however im not really sure how to do that? Can you give a short sample if possible? Thanks again
Sure, take the following example:
The first compose action is just a container for example JSON, which is:
{
"Country": "United Kingdom",
"SerialNo\r": "\"215211291266\"\r"
}
The action Compose 2 removes only the \r elements and produces output like this:
{
"Country": "United Kingdom",
"SerialNo": "\"215211291266\""
}
The code for Compose 2 is:
json(replace(string(outputs('Compose')), '\r', ''))
The action Compose 3 removes both the \r and the escaped quote characters you have in your JSON and produces the output:
{
"Country": "United Kingdom",
"SerialNo": "215211291266"
}
The code for Compose 3 is:
json(replace(replace(string(outputs('Compose')), '\r', ''), '\"', ''))
In both cases, the JSON is first converted to a string with the string function, then replace is used to remove the elements which are to be removed. Then it is converted back to JSON format with the json expression.
Does that help?
Blog: tachytelic.net
YouTube: https://www.youtube.com/c/PaulieM/videos
If I answered your question, please accept it as a solution 😘
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
64 | |
23 | |
16 | |
15 | |
11 |
User | Count |
---|---|
121 | |
36 | |
32 | |
28 | |
26 |