Quick Fix: Microsoft Flow Error - Invalid type. Expected String but got Null.

less than 1 minute read

Hi, today I came across JSON parser error in Microsoft Flow. I used auto-generated schema and everything had been working just fine until a connector I used had started to return null values for strings.

The fix is quite easy. You just need to manually modify a type of property in the schema. By default you get type String but it is not nullable type.

Fortunatelly JSON Parser in Microsoft Flow can handle multiple types in the schema:

    {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "Description": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    }

So you just need to change

    "type": "string"

to

    "type": ["string", "null"]

Comments

Rostyslav

{ “type”: “object”, “properties”: { “Fields”: { “type”: “array”, “items”: { “type”: “object”, “properties”: { “FieldLabel”: { “type”: [ “string”, “integer” ] }, “Item”: { “type”: “string” }, “ItemElementName”: { “type”: “string” } } } }, “Links”: { “type”: “array”, “items”: { “type”: “object”, “properties”: { “rel”: { “type”: “string” }, “href”: { “type”: “string” } }, “required”: [ “rel”, “href” ] } }, “Id”: { “type”: “integer” }, “Title”: { “type”: “string” } } }

Doesn’t work form me,

Error Action ‘Parse_JSON_from_File’ failed

Any other ideas?

Rostyslav

Okay, so I did make it work, but if you use more than one type, the ITEM doesn’t appear in dynamic content.

Leave a Comment

Your email address will not be published. Required fields are marked *

Loading...