Master String to Data Type Conversions in Power Automate

When working with Power Automate, data is often received as text (string) from various sources such as SharePoint, Excel, Forms, APIs, Dataverse, and JSON payloads. However, many actions require specific data types like Integer, Float, Boolean, Date, Array, or Object. Therefore, converting strings into appropriate data types is an essential skill for building efficient flows.

In this article, we'll explore how to convert string values into different data types using Power Automate expressions.

Why Convert Data Types?

Data type conversion helps:

Prerequisites

Before starting:

Example Input:

"100"
"99.99"
"true"
"2025-06-17"
"[1,2,3]"
{"Name":"John","Age":30}

Convert String to Integer

Suppose the string value is:

"100"

Use the following expression:

int('100')

Output:

100

This converts the string into an Integer data type.

Convert String to Float

String Value:

"99.99"

Expression:

float('99.99')

Output:

99.99

Useful for currency and decimal calculations.

Convert String to Boolean

String Value:

"true"

Expression:

bool('true')

Output:

true

Another example:

bool('false')

Output:

false

Convert String to Date

String Value:

"2025-06-17"

Expression:

formatDateTime('2025-06-17','dd-MM-yyyy')

Output:

17-06-2025

You can use different date formats based on your business requirements.

Convert String to Array

String Value:

"[Apple,Orange,Mango]"

Expression:

json('["Apple","Orange","Mango"]')

Output:

["Apple","Orange","Mango"]

The string is converted into an Array object.

Convert String to JSON Object

String Value:

{"Name":"John","Age":30}

Expression:

json('{
"Name":"John",
"Age":30
}')

Output:

{"Name":"John","Age":30}

This converts the string into a usable JSON object.

Convert String to Number Using Compose

Example:

"500"

Expression:

int(outputs('Compose'))

Output:

500

This method is commonly used when values come dynamically from previous actions.

Real-Time Example

Suppose a Microsoft Form returns:

{"EmployeeID":"1001","Salary":"50000.50","IsActive":"true"}

Convert values:

These conversions allow Power Automate to process the data correctly.

Common Conversion Functions

Function Purpose
int() Convert String to Integer
float() Convert String to Decimal
bool() Convert String to Boolean
string() Convert Value to String
json() Convert String to JSON
formatDateTime() Convert Date String
concat() Combine Strings
coalesce() Handle Null Values

Benefits

Best Practices

Common Use Cases

Conclusion

Data type conversion is one of the most commonly used techniques in Power Automate. Whether you're working with SharePoint, Dataverse, Excel, APIs, or Forms, converting string values into Integer, Float, Boolean, Date, Array, or JSON formats ensures your flows run smoothly and efficiently.

By using built-in Power Automate expressions like int(), float(), bool(), and json(), you can create robust automations that handle data accurately and reliably.