Skip to main content

Notifications

Power Automate - Building Flows
Unanswered

Parse JSON into multiple records to create item in Sharepoint

(0) ShareShare
ReportReport
Posted on by 28

Hello

 

I am looking to parse JSON from a payment provider and populate into a SharePoint list. I have successfully gotten the JSON but am having trouble getting each record into SharePoint. I have created one record with blank information.

 

JSON schema:

 

{
 "type": "object",
 "properties": {
 "object": {
 "type": "string"
 },
 "id": {
 "type": "string"
 },
 "amount": {
 "type": "integer"
 },
 "amount_refunded": {
 "type": "integer"
 },
 "application": {},
 "application_fee": {},
 "application_fee_amount": {},
 "balance_transaction": {
 "type": "string"
 },
 "billing_details": {
 "type": "object",
 "properties": {
 "address": {
 "type": "object",
 "properties": {
 "city": {},
 "country": {},
 "line1": {},
 "line2": {},
 "postal_code": {},
 "state": {}
 }
 },
 "email": {},
 "name": {
 "type": "string"
 },
 "phone": {}
 }
 },
 "calculated_statement_descriptor": {},
 "captured": {
 "type": "boolean"
 },
 "created": {
 "type": "integer"
 },
 "currency": {
 "type": "string"
 },
 "customer": {},
 "description": {
 "type": "string"
 },
 "disputed": {
 "type": "boolean"
 },
 "failure_code": {},
 "failure_message": {},
 "fraud_details": {
 "type": "object",
 "properties": {}
 },
 "invoice": {},
 "livemode": {
 "type": "boolean"
 },
 "metadata": {
 "type": "object",
 "properties": {
 "uuid": {},
 "webform": {},
 "webform_id": {},
 "webform_submission_id": {},
 "course": {},
 "offering": {},
 "company": {},
 "phone": {}
 }
 },
 "on_behalf_of": {},
 "order": {},
 "outcome": {},
 "paid": {
 "type": "boolean"
 },
 "payment_intent": {},
 "payment_method": {
 "type": "string"
 },
 "payment_method_details": {
 "type": "object",
 "properties": {
 "card": {
 "type": "object",
 "properties": {
 "brand": {
 "type": "string"
 },
 "checks": {
 "type": "object",
 "properties": {
 "address_line1_check": {},
 "address_postal_code_check": {},
 "cvc_check": {
 "type": "string"
 }
 }
 },
 "country": {
 "type": "string"
 },
 "exp_month": {
 "type": "integer"
 },
 "exp_year": {
 "type": "integer"
 },
 "fingerprint": {
 "type": "string"
 },
 "funding": {
 "type": "string"
 },
 "installments": {},
 "last4": {
 "type": "string"
 },
 "network": {
 "type": "string"
 },
 "three_d_secure": {},
 "wallet": {}
 }
 },
 "type": {
 "type": "string"
 }
 }
 },
 "receipt_email": {},
 "receipt_number": {},
 "receipt_url": {
 "type": "string"
 },
 "refunded": {
 "type": "boolean"
 },
 "refunds": {
 "type": "object",
 "properties": {
 "object": {
 "type": "string"
 },
 "data": {
 "type": "array"
 },
 "has_more": {
 "type": "boolean"
 },
 "url": {
 "type": "string"
 }
 }
 },
 "review": {},
 "shipping": {},
 "source_transfer": {},
 "statement_descriptor": {},
 "statement_descriptor_suffix": {},
 "status": {
 "type": "string"
 },
 "transfer_data": {},
 "transfer_group": {}
 }
}

 

 Overall FlowOverall Flow

Expansion of parsing and creating an arrayExpansion of parsing and creating an array

The Get items obtains values from the current SharePoint list. The conditions looks at if the item is already in the SharePoint list. These seem to be working.

Populating sharepoint listPopulating sharepoint list

 

 

  • lokeshpatel Profile Picture
    lokeshpatel 28 on at
    Re: Parse JSON into multiple records to create item in Sharepoint

    Hi @v-alzhan-msft 

     

    When I do this, it gives me an error at the Apply to each:

    The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('Parse_JSON_3')' is of type 'Object'. The result must be a valid array.

     

    One thing to note is that my JSON currently has 3 records. It is listed as:

     

    {
     "object": "list",
     "data": [
     {
     "id": "XXXXXXXXXXXXXXXXXX",
     "object": "XXXXXXXXXX",
  • tlevine Profile Picture
    tlevine 230 on at
    Re: Parse JSON into multiple records to create item in Sharepoint

    Hi - I was able to complete this without having to use a flow, but rather a simple patch statement with my gallery

     

    ForAll(
     Gallery3_1.AllItems,
     Patch(
     'Shortage Report',
     Defaults('Shortage Report'),
     {
     Site: site1.Text,
     PWD: pwd1.Text,
     'Request Status': "Open",
     'Submitted By': varUser,
     'Submitted Date': varToday,
     'WIP DU': wipdu1.Text,
     'Cases Required': cs1.Text,
     'FG DU': fgdu1.Text,
     'Multiple DU Indicator': multdu1.Text
     }
     )
    )

     

     

  • Re: Parse JSON into multiple records to create item in Sharepoint

    Hi @tlevine ,

     

    First, flow screenshot in edit mode.

    Second, troubleshooting the Get items action, don't add item to the list, just add the column value in a Compose.

     

    Best Regards,

    Alice

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • tlevine Profile Picture
    tlevine 230 on at
    Re: Parse JSON into multiple records to create item in Sharepoint

    @v-alzhan-msft  - can you clarify both of the points you mentioned?

  • Re: Parse JSON into multiple records to create item in Sharepoint

    Hi @tlevine ,

     

    I need the screenshot of the configuration of the flow.

    And Since the flow is failed at the Create item action, please take a try get the column value, save it in the Compose to see if it works.

     

    Best Regards,

    Alice

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • tlevine Profile Picture
    tlevine 230 on at
    Re: Parse JSON into multiple records to create item in Sharepoint

    Please see the attached documentation @v-alzhan-msft Capture.PNG

  • Re: Parse JSON into multiple records to create item in Sharepoint

    Hi @tlevine ,

     

    Could you please share the screenshot of your flow?

     

    Best Regards,

    Alice

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • tlevine Profile Picture
    tlevine 230 on at
    Re: Parse JSON into multiple records to create item in Sharepoint

    hi @v-alzhan-msft - I receive the following error message when following the steps you outlined below. 

     

    Any recommendations on how to resolve?

     

    Screen Shot 2020-05-17 at 11.33.59 PM.png

  • Re: Parse JSON into multiple records to create item in Sharepoint

    Hi @lokeshpatel ,

     

    You needn't to create array for the items, just apply to each record from the Body output of the Parse JSON action as my screenshot below:

    1.png

     

    Best Regards,

    Alice

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • tlevine Profile Picture
    tlevine 230 on at
    Re: Parse JSON into multiple records to create item in Sharepoint

    I am looking to do the same thing - hope to have some insight from the community here! 🙂 @lokeshpatel 

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard