toDict() and java.math.BigDecimal

So this just started happening.... When I call the .toDict() method on Memory Tag, of value type "document" all of the Integers and Floats are cast as <type 'java.math.BigDecimal'>.

parsed = system.tag.readBlocking(["[default]SomeTag",])[0].value

parsed = parsed.toDict()

for key in parsed["chassis"]["abs"]["parameters"]:
	
	print parsed["chassis"]["abs"]["parameters"][key], type(parsed["chassis"]["abs"]["parameters"][key])

Resulting in

>>> 
[1, 2] <type 'unicode'>
0 <type 'java.math.BigDecimal'>
[1, 2] <type 'unicode'>
34 <type 'unicode'>
4 <type 'java.math.BigDecimal'>
N <type 'unicode'>
[1, 2] <type 'unicode'>
0 <type 'java.math.BigDecimal'>
1 <type 'java.math.BigDecimal'>
R86 <type 'unicode'>
0 <type 'java.math.BigDecimal'>
0 <type 'java.math.BigDecimal'>
1 <type 'java.math.BigDecimal'>
1 <type 'java.math.BigDecimal'>

I pulled out what little hair I had left trying to figure out why my test scripts starting throwing KeyErrors when referencing dictionary keys...

Any ideas of why this is occurring? Note: the tag is written as a string and cast 'document' value type.

Thanks!

Does the same problem occur if you write it dict(parsed) instead of parsed.toDict()?

I fail to see how converted values could make your script raise KeyErrors.
What you're printing is the values and their types, not the keys.
It could be written like this to make it clearer that you're not dealing with the keys:

for key, value in parsed["chassis"]["abs"]["parameters"].iteritems():
	print value, type(value)

Can we see the script that raises the keyError ?

We were using the 'ast' library... once I pulled the ast implementation, everything returned to normal-- no casting of java.math.BD

Hello guys, can you share how did you remove the "ast implementation" you are talking about? I am having exactly the same issue.

We need to see the code to help you modify it. We can't just guess what you're dealing with.

In my particular case, my team had imported the "ast" (abstract syntax tree) library for some of the scripting. The library had been purposely added thus removing the library import call stopped my INTs, FLOATs, ect. from being parsed incorrectly, or more precisely- stopped them from being parsed into unexpected python 'privatives'.