cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
guyinkalamazoo
Helper III
Helper III

CSV to JSON to SharePoint Item

EDIT:  Thanks to this article by Tomas Prokop, I fixed the issue: Quick Fix: Microsoft Flow Error - Invalid type. Expected String but got Null. - NETWORG Blog (thenet...

 

I have followed other posts and instructions and have successfully built a flow to the point of creating a file from a csv being saved into a directory (that is the trigger) to taking the csv and making a json file.  I want to take that json and create new items in a sharepoint list.  This is where I am getting and error.  Here is some sample of the file (but has dozens of other records as well):

 

[
{
    "Order Key": "39264927",
    "Omar Order Number": "392649270010",
    "Order Type Key": "GCRM",
    "MAT Type Key": "STA",
    "Order Plant": "Kalamazoo",
    "Omar Status Code": "ASSN",
    "MDSI  Job Code": "31300210",
    "Omar Reason Code Key": "OVRD",
    "Omar Tech ID": "BJSMITH2",
    "Field Comments": "WARNING OF QUALS MISMATCH WAS OVERRIDDEN",
    "Number of Records": "1"
  },
  {
    "Order Key": "39266790",
    "Omar Order Number": "392667900010",
    "Order Type Key": "GDMR",
    "MAT Type Key": "CLS",
    "Order Plant": "Livonia",
    "Omar Status Code": "ASSN",
    "MDSI  Job Code": "31200000",
    "Omar Reason Code Key": "OVRD",
    "Omar Tech ID": "GRSWANSO",
    "Field Comments": "WARNING OF QUALS MISMATCH WAS OVERRIDDEN",
    "Number of Records": "1"
  },
  {
    "Order Key": "",
    "Omar Order Number": null,
    "Order Type Key": null,
    "MAT Type Key": null,
    "Order Plant": null,
    "Omar Status Code": null,
    "MDSI  Job Code": null,
    "Omar Reason Code Key": null,
    "Omar Tech ID": null,
    "Field Comments": null,
    "Number of Records": null
  }
]

 

You can see, the last record is NULL.  The error I am getting is an Invalid Type. Expected Object but got Array error.  What is the proper way to parse the JSON?  It is as simple as removing the brackets from the file?

 

Thanks for the information

1 REPLY 1
abm
Super User
Super User

Hi @guyinkalamazoo 

 

I copied your data and tried and I am getting the below error.

 

image.png

 

The above error is due to the last row in the JSON have null values. To overcome this error you need to specify in your Parse JSON schema there are string and null values.

 

"Order Key": {
                "type": ["string", "null"]
            }
 
Do the same for all the properties.
 
Your error is related to something else. Could you post the whole JSON sample file?
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (4,185)