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 / String to Integer in a...
Power Automate
Unanswered

String to Integer in a Parse JSON from an Array

(0) ShareShare
ReportReport
Posted on by 229

Hi, 

 

I'm having problems with invalid types of data in my scenario and would be great if someone could give some hint.

 

My scenario is doing the following:

  1. getting the tables on an excel file
  2. Listing the rows on the table
  3. Storing the list of rows in an Array called Table_Output
  4. Using Parse JSON with a defined Schema to work with the previous data.

This is my table

Table.JPG

And this is my flow

Flow PRocess.JPG

 

This is the content in the Parse JSON

 

[
 {
 "@odata.etag": "",
 "ItemInternalId": "f2d1e93b-f1a2-42ad-886d-a1290d1156df",
 "Name": "John",
 "Value": "3",
 "City": "London"
 },
 {
 "@odata.etag": "",
 "ItemInternalId": "91c8c219-5cbb-4fb8-b738-90074940e4d7",
 "Name": "Jack",
 "Value": "1",
 "City": "Chicago"
 },
 {
 "@odata.etag": "",
 "ItemInternalId": "471edf2d-bd99-4cc5-b901-0549a9560b82",
 "Name": "Jill",
 "Value": "8",
 "City": "Madrid"
 }
]

 

 

And this is the JSON Schema

 

{
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "Name": {
 "type": "string"
 },
 "Value": {
 "type": "integer"
 },
 "City": {
 "type": "string"
 }
 },
 "required": [
 "Name",
 "Value",
 "City"
 ]
 }
}

 

 

The issue is that [Value] is expecting an integer but it is getting from the Table_Output array an string.

 

 

[
 {
 "message": "Invalid type. Expected Integer but got String.",
 "lineNumber": 0,
 "linePosition": 0,
 "path": "[0].Value",
 "value": "3",
 "schemaId": "#/items/properties/Value",
 "errorType": "type",
 "childErrors": []
 },
 {
 "message": "Invalid type. Expected Integer but got String.",
 "lineNumber": 0,
 "linePosition": 0,
 "path": "[1].Value",
 "value": "1",
 "schemaId": "#/items/properties/Value",
 "errorType": "type",
 "childErrors": []
 },
 {
 "message": "Invalid type. Expected Integer but got String.",
 "lineNumber": 0,
 "linePosition": 0,
 "path": "[2].Value",
 "value": "8",
 "schemaId": "#/items/properties/Value",
 "errorType": "type",
 "childErrors": []
 }
]

 

 

I've tried to use the formula int() to convert in the array to integer, but I can't target the correct column,  but it is not working. I've also tried to change the schema to get a string (this is working) and then change Value to integer, but again it is not working. If I try a Compose to convert to integer value, it is not displaying the field "Value" in the Data Operation, only the {body}.

 

Parse JSON.JPG

 

Any suggestion how I can convert a String to Integer there?

 

Many thanks

Categories:
I have the same question (0)
  • ChristianAbata Profile Picture
    8,951 Most Valuable Professional on at

    hi @Sam4  you can try by deleting the type 

     "Value": {
     "type": "integer"
     },
  • Sam4 Profile Picture
    229 on at

    Thanks @ChristianAbata , 

     

    If I take the Value out from the Schema, I still get it as a String in the Parse JSON Output. I think that I need to prepare the value before using the Schema or using an intermediate step that I am missing.

     

    Check.JPG

     

     

     

  • ChristianAbata Profile Picture
    8,951 Most Valuable Professional on at

    @Sam4  if you need to get an specific value yes what I did is exactly what you said I preparate my Squema to get the type I need. But see is you delete the type in your schema

    "Value": {
     "type": "integer"
     },

     

    Like this

     

    "Value": {
     },

     

    You can use your value no matters what tipe of value you are going to receive even Null values, so then you can manage that result using expressions.

     

    So for example if you want to use int values you can add a compose action an then add the expression int('HERE YOUR JSON PROPERTIE') to transform what you send into an integer value the same as Strig or other data type.

  • Verified answer
    v-litu-msft Profile Picture
    on at

    Hi @Sam4,

     

    You could use the Select action to convert the String into Integer.

     

    Annotation 2020-07-02 150000.jpg

     

    Run result:

    Annotation 2020-07-02 145913.jpg

     

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

  • Sam4 Profile Picture
    229 on at

    Thanks @v-litu-msft that was exactly what I was looking for. My scenario is working now. 

     

    Kind Regards 

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard