web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Parse JSON, Invalid ty...
Power Automate
Answered

Parse JSON, Invalid type. Expected Object but got Array

(0) ShareShare
ReportReport
Posted on by 353

I've built a flow that connects to the O365 Management Service and retrieves the last 24 hours of audit logs in JSON. 

 

When I try to parse the JSON I get an error. Can anyone suggest why? 

This is the first part of the JSON. 

 

 

[
 {
 "AppAccessContext": {
 "CorrelationId": "aaaa-606d-7000-1193-a81da98aeed8",
 "UniqueTokenId": "aaaa-XZA8nAA"
 },
 "CreationTime": "2023-07-31T02:27:19",
 "Id": "aaaa-87c5-433f-ed5a-08db916daa64",
 "Operation": "FilePreviewed",
 "OrganizationId": "aaaa-8c30-4f06-bb03-a0fc334c4f9f",
 "RecordType": 6,
 "UserKey": "i:0h.f|membership|aaaa@live.com",
 "UserType": 0,
 "Version": 1,
 "Workload": "OneDrive",
 "ClientIP": "aaaa.105.139.166",
 "ObjectId": "https://aaaa-my.sharepoint.com/aaaa",
 "UserId": "aaaa.aaaa@aaaa-ltd.com",
 "AuthenticationType": "OAuth",
 "BrowserName": "",
 "BrowserVersion": "",
 "CorrelationId": "aaaa-606d-7000-1193-a81da98aeed8",
 "DoNotDistributeEvent": true,
 "EventSource": "SharePoint",
 "IsManagedDevice": true,
 "ItemType": "File",
 "ListId": "aaaa-55ff-4d42-9bcd-cc2c2c409f53",
 "ListItemUniqueId": "aaaa-02b6-4832-893d-a863f1e7b623",
 "Platform": "Service",
 "Site": "aaaa-e37a-4708-9325-e513144bd894",
 "UserAgent": "OneDriveMpc-Transform_Thumbnail/1.0",
 "WebId": "aaaa-ffe3-4b99-80e4-63b23b3b01a0",
 "DeviceDisplayName": "aaaa.79.237.33",
 "HighPriorityMediaProcessing": false,
 "ListBaseType": 1,
 "ListServerTemplate": 700,
 "SourceFileExtension": "html",
 "SiteUrl": "https://aaaa-my.sharepoint.com/aaaa",
 "SourceFileName": "Microsoft Bing Travel - Copenhagen.html",
 "SourceRelativeUrl": "Documents/Desktop"
 },

 

 



schema ;

 

 

{
 "type": "object",
 "properties": {
 "content": {
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "AppAccessContext": {
 "type": "object",
 "properties": {
 "ClientAppId": {
 "type": "string"
 },
 "ClientAppName": {
 "type": "string"
 },
 "CorrelationId": {
 "type": "string"
 },
 "TokenIssuedAtTime": {
 "type": "string"
 }
 }
 },
 "CreationTime": {
 "type": "string"
 },
 "Id": {
 "type": "string"
 },
 "Operation": {
 "type": "string"
 },
 "OrganizationId": {
 "type": "string"
 },
 "RecordType": {
 "type": "integer"
 },
 "UserKey": {
 "type": "string"
 },
 "UserType": {
 "type": "integer"
 },
 "Version": {
 "type": "integer"
 },
 "Workload": {
 "type": "string"
 },
 "ClientIP": {
 "type": "string"
 },
 "ObjectId": {
 "type": "string"
 },
 "UserId": {
 "type": "string"
 },
 "ApplicationDisplayName": {
 "type": "string"
 },
 "ApplicationId": {
 "type": "string"
 },
 "AuthenticationType": {
 "type": "string"
 },
 "CorrelationId": {
 "type": "string"
 },
 "EventSource": {
 "type": "string"
 },
 "IsManagedDevice": {
 "type": "boolean"
 },
 "ItemType": {
 "type": "string"
 },
 "ListId": {
 "type": "string"
 },
 "ListItemUniqueId": {
 "type": "string"
 },
 "Site": {
 "type": "string"
 },
 "WebId": {
 "type": "string"
 },
 "DeviceDisplayName": {
 "type": "string"
 },
 "HighPriorityMediaProcessing": {
 "type": "boolean"
 },
 "ListBaseType": {
 "type": "integer"
 },
 "ListServerTemplate": {
 "type": "integer"
 },
 "SourceFileExtension": {
 "type": "string"
 },
 "SiteUrl": {
 "type": "string"
 },
 "SourceFileName": {
 "type": "string"
 },
 "SourceRelativeUrl": {
 "type": "string"
 }
 },
 "required": [
 "AppAccessContext",
 "CreationTime",
 "Id",
 "Operation",
 "OrganizationId",
 "RecordType",
 "UserKey",
 "UserType",
 "Version",
 "Workload",
 "ClientIP",
 "ObjectId",
 "UserId",
 "ApplicationDisplayName",
 "ApplicationId",
 "AuthenticationType",
 "CorrelationId",
 "EventSource",
 "IsManagedDevice",
 "ItemType",
 "ListId",
 "ListItemUniqueId",
 "Site",
 "WebId",
 "DeviceDisplayName",
 "HighPriorityMediaProcessing",
 "ListBaseType",
 "ListServerTemplate",
 "SourceFileExtension",
 "SiteUrl",
 "SourceFileName",
 "SourceRelativeUrl"
 ]
 }
 }
 }
}

 

 

 
and the error;

 

 

[
 {
 "message": "Invalid type. Expected Object but got Array.",
 "lineNumber": 0,
 "linePosition": 0,
 "path": "",
 "schemaId": "#",
 "errorType": "type",
 "childErrors": []
 }
]

 

 

 

 

nick9one1_0-1690817807012.png

 

Categories:
I have the same question (0)
  • Verified answer
    nick9one1 Profile Picture
    353 on at

    I solved this by using a 3rd party JSON to JSON Schema converter. It seems the built in 'generate from JSON' button doesnt work too well. 
    https://redocly.com/tools/json-to-json-schema/

    then I validated the json using this tool 

    https://www.jsonschemavalidator.net/ 

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 410

#2
Vish WR Profile Picture

Vish WR 289

#3
David_MA Profile Picture

David_MA 282 Super User 2026 Season 1

Last 30 days Overall leaderboard