Mapping between Java and JavaScript

Hello.

I recently ran into some inconsistencies with mapping between Java and JavaScript. Sometimes it manages to serialize the Java object, and you can use it directly and other times you have to JSON.parse() the object returned.

Could you explain how the mapping/serializing is done, and why it gives different results sometimes?

Could you be more presice? The translation is typically done in the libraries you use (unless you are doing it yourself) - if it returns the whole Java object, this is either a mistake or intentional and should be documented as such.