Skip to main content

Notifications

Community site session details

Community site session details

Session Id : AbE9JoDHYX5hN0/gpfvgYu
Power Automate - Building Flows
Answered

String to Integer in a Parse JSON from an Array

Like (0) ShareShare
ReportReport
Posted on 1 Jul 2020 19:27:07 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

  • Sam4 Profile Picture
    229 on 02 Jul 2020 at 13:45:32
    Re: String to Integer in a Parse JSON from an Array

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

     

    Kind Regards 

  • Verified answer
    v-litu-msft Profile Picture
    on 02 Jul 2020 at 07:01:57
    Re: String to Integer in a Parse JSON from an Array

    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.

  • ChristianAbata Profile Picture
    8,947 Most Valuable Professional on 01 Jul 2020 at 22:23:35
    Re: String to Integer in a Parse JSON from an Array

    @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.

  • Sam4 Profile Picture
    229 on 01 Jul 2020 at 21:17:31
    Re: String to Integer in a Parse JSON from an Array

    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,947 Most Valuable Professional on 01 Jul 2020 at 20:43:40
    Re: String to Integer in a Parse JSON from an Array

    hi @Sam4  you can try by deleting the type 

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

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 61

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 47 Super User 2025 Season 1

#3
rzaneti Profile Picture

rzaneti 31 Super User 2025 Season 1

Overall leaderboard