ConvertTo-Json (Microsoft.PowerShell.Utility) - PowerShell
The ConvertTo-Json cmdlet converts any .NET object to a string in JavaScript Object Notation (JSON) format. The properties are converted to field names, the field values are converted to property values, and the methods are removed. Note As of PowerShell 7.2, Extended Type System properties of DateTime and String objects are no longer serialized and only the simple object is converted to JSON format You can then use the ConvertFrom-Json cmdlet to convert a JSON-formatted string to a JSON object, which is easily managed in PowerShell. Many web sites use JSON instead of XML to serialize data for communication between servers and web-based apps. As of PowerShell 7.1, ConvertTo-Json emits a warning if the depth of the input object exceeds the depth specified for the command. This prevents unwanted data loss when converting objects. As of PowerShell 7.5-preview.3, ConvertTo-Json can serialize BigInteger values as raw JSON numbers. This cmdlet was introduced in Windows PowerShell 3.0.
learn.microsoft.com