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 Flow
Expansion 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 list
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",
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
}
)
)
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.
@v-alzhan-msft - can you clarify both of the points you mentioned?
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.
Please see the attached documentation @v-alzhan-msft
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.
hi @v-alzhan-msft - I receive the following error message when following the steps you outlined below.
Any recommendations on how to resolve?
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:
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.
I am looking to do the same thing - hope to have some insight from the community here! 🙂 @lokeshpatel