mherkender/actionjson

what if object is IExternalizable

iovdin opened this issue · 3 comments

if an object should not be serialized with for in loop, but in a special way
e.g. ObjectProxy from mx.utils. It does not seem currect code counts that case

It's unclear to me what format an IExternalizable-compatible class should conform to. Is it a string? An array? Since it writes directly to output, I must transform it into proper format for JSON-compatibility but I don't know what that would be. It seems to me that IExternalizable should be ignored as a special format.

I'd like to know your opinion on this, what do you think the best way to handle IExternalizable should be?

yeah skip is an option, another one is to use writeExternal method of IExternalizable,
so you write to ByteArray and then convert it to a string. Base64 or toString(), not sure a method should be chosen to be easily convertable to ByteArray.

I'd rather leave that to the user. They can serialize an IExternalizable class before passing it to a JSON encoder. It's also worth mentioning no other JSON library supports IExternalizable that I'm aware of.