I want to interop PowerShell with Java. That is, I want to call a PowerShell script from Java and receive back objects.
I can launch the PowerShell in a separate process and capture the output as demonstrated in Invoke Powershell scripts from Java.
To transfer objects from one process to another, I want to serialize them in a Json format.
Is there a PowerShell command to turn an object into a JSON formatted string, or do I need to reach for a .NET object to do this as shown in JSON Serialization/Deserialization in PowerShell?
Will the Microsoft JSON interop with Java JSON packages?
Is there a better solution than JSON? E.g. XML serialization?
there is the convertTo-json cmdlet in PS V3 http://technet.microsoft.com/en-us/library/hh849922.aspx