cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Julian1
Level: Powered On

Parse and Edit JSON to a new assembled String Variable Output

Hi Guys,

 

I have done some Flows but right now I have a new Task... Bringing an JSON into a String/Flattext Format...

 

So I have this Input-Data:

[
  {
    
    "title": "Form_01",
    "data": {
      "Person": {
        "Email": "Julian@Email.com",
        "Name": "Julian Menowin",
        "MA_No": "M.73",
        "Category": "1",
        "Shorthandle": "LOG"
      },
      "P_Auswahl": {
        "ProjectNo": "P.1190220",
        "ProjectName": "DUMMY_ONE",
        "Description": "XYZ "
      },
      "Name": "Julian Menowin",
      "MA_No": "M.73",
      "ProjektName": "DUMMY_ONE",
      "ProjectNo": "P.1190220",
      "starttime": "2019-08-02T09:32:15.8335694Z",
      "breakstart": "2019-08-02T09:32:23.764065Z",
      "breakend": "2019-08-02T09:32:24.6424168Z",
      "endtime": "2019-08-02T09:32:25.8338132Z"
    }
  }
]

Now I only want to access/parse/select the last 9 variables:

 

"Name": "Julian Menowin",
"Category": "1", "MA_No": "M.73", "ProjektName": "DUMMY_ONE", "ProjectNo": "P.1190220", "starttime": "2019-08-02T09:32:15.8335694Z", "breakstart": "2019-08-02T09:32:23.764065Z", "breakend": "2019-08-02T09:32:24.6424168Z", "endtime": "2019-08-02T09:32:25.8338132Z"

 

 

 

These values (for example the value "M.73" of the variable "MA_No") of the 8 variables need to be edited (partly...for example the date/time format) and then somehow be pasted into a Flat-Text (String with multiple linebreaks) in this form of Outputdata:

 

{
2019-07-22 08:00:00,M.73.1
2019-07-22 08:00:00,L.AZ
2019-07-22 08:00:00,P.1190083.1
2019-07-22 08:00:00,Z.4
2019-07-22 12:00:00,M.73.1
2019-07-22 12:00:00,BREAK
2019-07-22 12:00:00,P.1190083.1
2019-07-22 12:00:00,Z.0.75
2019-07-22 12:45:00,M.73.1
2019-07-22 12:45:00,L.AZ
2019-07-22 12:45:00,P.1190083.1
2019-07-22 12:45:00,Z.4
2019-07-22 16:45:00,M.73.1
2019-07-22 16:45:00,BREAK
}

 

So it should start something like this:

Action NewString: "2019-08-02T09:32:15.8335694Z" Replace "T" with " " and erase everything (& including) the last point ( ".8335694Z" etc)
Action FirstLineofOutput: CONCAT NewString with ",{MA_No}.{Category}"

...etc.

 

If someone is able to help me with the first line I would be able to get the rest done by myself.

 

I appreciate every tip and hint ❤️

 

 

Ps.: Here is a Screenshot with colored lines for better clarity 

1 REPLY 1
Super User
Super User

Re: Parse and Edit JSON to a new assembled String Variable Output

@Julian1 

Hi there - Apologies for the delay, there's a bit to unpack so I wanted to test some things first.

 

Honestly, you're pretty close.  There are a couple of pieces that you need and I think you'll be off to the races on your own:

    • Add a Parse JSON step after your input-data.  If you haven't used it before, you can use the sample data that you have above and Flow will build the schema automatically for you.  It's what I did in the first couple of images below (I used a Compose to simulate your inputs).
      20191024b.PNG

       

20191024c.PNG

 

  • The other thing is that you don't want to "remove" the T from the date/time, just reformat the date.  The main problem is, though, that it's seeing your date/time as a plain text (string), so we'll want to edit it and format it, as well.  It feels like there can be multiple start times, and that may kick off an Apply to Each loop.  So let's start with the Parse JSON and see where we need to go from there.

Give that a try and let us know how it goes.

-Ed-

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,914)