Victor Polischuk
2018-04-11 04:48:02 UTC
Dear all,
I apologize if the question was already raised in the mail list, however, I find it quite strange that JSObject lacks convenient methods to convert it at least to JSON-string, if not directly to Java-POJOs?
The Internet is full of suggestions which involve JavaScript JSON.stringify(..) as a utility. While it might work too, but I guess a lot of others are just traversing the JSObject by their own "converters".
Therefore, if there is no design limitations/reasons why the conversion should/could not be applied within the Java representation, I am ready to volunteer on the patch.
My reason for it are:
* It looks quite ugly to execute JavaScript to make something with "almost" Java object.
* Java has enormous number of JSON libraries already. I guess it is nice to allow people connect their favorite with minimal efforts. Potentially, if it will be required "string" phase might be excluded (not JSObject->String->POJO, but JSObject->POJO).
* It may simplify logging/debugging of interaction between Java and JS.
/
Best Regards,
Victor
I apologize if the question was already raised in the mail list, however, I find it quite strange that JSObject lacks convenient methods to convert it at least to JSON-string, if not directly to Java-POJOs?
The Internet is full of suggestions which involve JavaScript JSON.stringify(..) as a utility. While it might work too, but I guess a lot of others are just traversing the JSObject by their own "converters".
Therefore, if there is no design limitations/reasons why the conversion should/could not be applied within the Java representation, I am ready to volunteer on the patch.
My reason for it are:
* It looks quite ugly to execute JavaScript to make something with "almost" Java object.
* Java has enormous number of JSON libraries already. I guess it is nice to allow people connect their favorite with minimal efforts. Potentially, if it will be required "string" phase might be excluded (not JSObject->String->POJO, but JSObject->POJO).
* It may simplify logging/debugging of interaction between Java and JS.
/
Best Regards,
Victor