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 / What's the type of NaN...
Power Automate
Answered

What's the type of NaN for "Parse JSON" schema?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello, 

 

I want to parse a JSON object that I'm getting from a query, and the variables in this JSON object are numbers, but that might be NaN. How can I define the schema for this JSON? If I use the returned object with "NaN", it will set the schema to "string", but if the returned value is "101" the schema will be set to "number", the two of them being not compatible. 

 

For instance, if my query returns this object:

{
"countStudents": 50,
"countRooms": 10
}

Then the generated schema type will be

{

"type": "object",

"properties": {

"countStudents": {

"type": "number"

},

"countRooms": {

"type": "number

}

}

 

But if it returns

{
"countStudents": "Nan",
"countRooms": 10
}

Then the schema will be 

{

"type": "object",

"properties": {

"countStudents": {

"type": "string"

},

"countRooms": {

"type": "number

}

}

 

Is there any way I can create a Schema valid for both? That is, can a property have several types?

Categories:
I have the same question (0)
  • Verified answer
    pablogracia Profile Picture
    Microsoft Employee on at

    Found the solution myself a couple of minutes later: A schema can have several type definitions for a variable, you just have to set the schema property like this:

    {

    ...

    "countStudents": {

    "type": ["string", "number"]

    }

    ...

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

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard