I'm attempting to port .Net PowerShell code over to Python. In order to ensure that the python code is correct I'm testing the PowerShell output vs the Python output.
In powershell I have
$ps_output = PowerShell-Function $log_path
$python_output = Python-Function $log_path
($ps_output -eq $python_output)
and if I run compare-object I get
InputObject SideIndicator
----------- -------------
The Python Win32 extensions for NT (service, event logging) appear not to be available. =>
[{'blocks': '5860533168', 'sn': 'PN2234J4T5DR', 'fw': 'MF8OAC0', 'device': 'da1', 'data': ['@{n... =>
[{"bay":"1","device":"da1","make":"HGST","type":"HUS724030ALA640","fw":"MF8OAC0","sn":"PN2234J4T5DR",... <=
I'm reasonably sure that the reason the equality check is failing is because the ordering of the key value pairs is different from python to PowerShell.
So I'm looking for a way to test equality between json objects in powershell or a means to order my python produced json in a way that matches the powershell output.
I've tried using an OrderedDict. This has the two fold problem of putting
[OrderedDict{...
in front of the string and also makes the code pretty brittle (since I'll have a dependency on when something is added to a dictionary).