cancel
Showing results for 
Search instead for 
Did you mean: 

emc_nbi.query return type

emc_nbi.query return type

Salva_ferrer
New Contributor III

Hello,

Why emc_query return type is a java format? It may look you manage it like a dict, but it isn't, it isn't anything like json nor a string that you can convert using json.loads.

Trying to iterate sitetree, is way more complex and checks like isinstance(node, ,dict) are impossible.

I think the return from emc_nbi.query should be a json or a plain string that can be parsed as a json.

Site engine 24.10

3 REPLIES 3

Ludovico_Steven
Extreme Employee

Works for me; forgot to add you would need this also:

from java.util import LinkedHashMap

Salva_ferrer
New Contributor III

Thank you Ludo!

Actually the line you suggest is not working either, but reminding me it's jython, not python was key, I ended up using native java classes and saving me all the code to format in json the hashmap..

Thank you!

Ludovico_Steven
Extreme Employee

Try this

isinstance(value, (dict, LinkedHashMap)): # XMC Python is Jython where a dict is in fact a java.util.LinkedHashMap

GTM-P2G8KFN