filmov
tv
Graph PowerShell tip to convert objects to json

Показать описание
Here's a quick Graph PowerShell trick that I learned recently. Did you know that every object has a ToJsonString method and it gives you the JSON formatted version of the object?
Now, you could always do the ConvertTo-Json method, but what that does is convert the graph PowerShell .net object model to JSON, which results in lots of these null values and it might not exactly be what you want. So for example, this has 600 odd lines compared to this, which gave me maybe about 10 or 20 lines for the actual object.
Now the other issue with this is if I were to get, for example, the manager field, you will see that it doesn't have the actual value. It has the object type name in it.
Instead we can use the ToJsonString method and it gives you a much more neater format of the object with the manager field expanded already.
I hope you found this useful.
Follow me for more tips and tricks on Graph PowerShell and Entra.
Now, you could always do the ConvertTo-Json method, but what that does is convert the graph PowerShell .net object model to JSON, which results in lots of these null values and it might not exactly be what you want. So for example, this has 600 odd lines compared to this, which gave me maybe about 10 or 20 lines for the actual object.
Now the other issue with this is if I were to get, for example, the manager field, you will see that it doesn't have the actual value. It has the object type name in it.
Instead we can use the ToJsonString method and it gives you a much more neater format of the object with the manager field expanded already.
I hope you found this useful.
Follow me for more tips and tricks on Graph PowerShell and Entra.
Graph PowerShell tip to convert objects to json
Getting Started with Microsoft Graph and PowerShell
Productivity Tips for working with Microsoft Graph and Microsoft Graph PowerShell – January 2023
Managing with Microsoft Graph (and PowerShell)
Episode #260 - Handling Throttling Exceptions with PowerShell and Microsoft Graph PowerShell SDK
PowerShell Quick Tips : Microsoft Graph
Microsoft Graph | Powershell Script from Scratch
Microsoft Graph PowerShell verbinden und verwenden – Microsoft 365 Basics 04
Mastering the Microsoft Graph PowerShell by Merill Fernando
How To Visualize JSON Files
Episode 001 - Using the Graph PowerShell SDK to Find Required Permissions
How To Scare C++ Programmer
Intune Graph API Query Tips and Graph X-Ray to get PowerShell Scripts from MEM Admin Center
Python vs C++ Speed Comparison
Junior Developer v/s Senior Developer😛 #shorts #funny
Introduction Microsoft Graph PowerShell v2 preview release
Start calling the Microsoft Graph API in under 5 minutes! | Tips & Tricks
PowerShell Tips for Managing Exchange Online at Scale
You've been copy and pasting wrong
Nesting 'If Statements' Is Bad. Do This Instead.
GitHub Copilot is SCARY Powerful! #shorts
Graph PowerShell: Manage Entra Identities and RBAC
My Jobs Before I was a Project Manager
Mr. Robot Sucks
Комментарии