system.util.jsonEncode() maximum recursion depth exceeded

Hi!

Sometimes when I try to encode an object (normally when I try to encode Ignition object as qualitycodes) it gives me this error:

RuntimeError: maximum recursion depth exceeded (Java StackOverflowError)

Any idea of this? And how to fix it or get around?
Thx in advance!

I think this might be because the QualityCode is nested inside the list. If you want to have it in a list you might have to convert it into a string or the respective integer code before the jsonEncode.