Parsing Object Script arrays in Python
Is there a way to automatically transform Object Script arrays to Python lists? This code results in a list of arrays
Iter0 = dbnative.iterator("HS.Data.OIDMapD")
for subscript, value in Iter0.items():
print(f"subscript={subscript}, value={value}")
Here is the result:
subscript=1, value=2.16.840.1.113883.3.86ISCInterSystems Corporation
I suppose it would be too hard to parse this into a list, I was just wondering if there was a function provided to make it convenient and proper.
Thanks,
Marlin Mixon
Product version: IRIS 2020.1
A little bit of cosmetics in your printf could make it JSON formatted.
print(f'{{"subscript":{subscript},"value":"{value}"}}')
which should result in a nice conveniant JSON object
{
"subscript":1,
"value":"2.16.840.1.113883.3.86ISCInterSystems Corporation"
}
For community Python Gateway I wrote an $lb -> tuple converter.
You can check it out here. To be callable from Python you can expose it as a Python C extension.