web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / JSON objects into sing...
Power Automate
Unanswered

JSON objects into single Create Item

(0) ShareShare
ReportReport
Posted on by 64

I have a flow where I want to process some JSON data returned from an API and create an item in a SharePoint list for each response. (The SharePoint List needs to be in a flat format, i.e. a column for each of the 'V' numbers, V48, V2, V66 etc.)

 

I've done the bulk of the processing fine but am coming stuck at the part where I create the item.

 

For instance, I've processed the data and ended up with a Select action with the output:

 

 

[
 {
 "V48": "1"
 },
 {
 "V2": "1"
 },
 {
 "V65": "457b67fc-edf8-41e2-8a44-1939da32c6ee"
 },
 {
 "V3": "17/07/2023"
 },
 {
 "V4": "13:10:53"
 },
 {
 "V5": "17/07/2023"
 },
 {
 "V6": "13:14:54"
 },
 {
 "V7": "4.02"
 },
 {
 "V55": "201127"
 }
]

 

 

 

If I Parse this response, and then put each value into a Create Item action, it puts the action into an Apply To Each loop and then creates multiple rows in the list with null values, i.e.

 

V48V2V65V3
1   
 1  
  457b67fc-edf8-41e2-8a44-1939da32c6ee 
   17/07/2023

 

If I don't do the Parsing, and use expressions in the create item, such as:

 

 

first(outputs('Select'))['V65']

 

 

I get an error message: Unable to process template language expressions in action 'Create_item' inputs at line '0' and column '0': 'The template language function 'first' expects its parameter be an array or a string. The provided value is of type 'Object'.

 

I'm missing something simple, but I cannot get my head around what the answer is.

Categories:
I have the same question (0)
  • Verified answer
    Socrates Profile Picture
    64 on at

    Right, of course as soon as I posted this I stumbled onto the (an?) answer.

     

    This blog helped massively. You have to turn the objects into a string, so you can replace the curly brackets thus making it a single object, then transform it back to JSON. His answer of having a Compose action with the expression:

     

     

    first(json(replace(string(outputs('Compose')),'},{',',')))

     

     

    (assuming 'Compose' is the output of my select action here) 

     

    kept failing for me, so I had to go one step backwards and just use:

     

     

    json(replace(string(outputs('Compose')),'},{',','))

     

     

    I then Parsed that and used each value to populate the create item columns. At this point it did pop the create items action into an Apply To Each loop, but that was fine in this scenario.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard