3 Replies Latest reply on Mar 18, 2015 8:11 AM by kcbabo

    How to register own JSON Transformer?

    ozkin

      How to register own JSON Transformer class instead of SY's own JSON2JavaTransformer?

      I need to do it because JSON2JavaTransformer is using older version of jackson library and doesn't support few features (for example, deserialization of json with unrecognized fields).

        • 1. Re: How to register own JSON Transformer?
          kcbabo

          Easiest way would be to create your own Java transformer class which bootstraps Jackson inside.  You can then just use this as a transform.java instead of using transform.json.  One thing to keep in mind is that the existing Jackson module will be on the class path for your application, so you will need to upgrade the version of Jackson in the existing module.

          • 2. Re: How to register own JSON Transformer?
            ozkin

            That's what I already did, implemented own Java transformer.

            But I haven't touched module configuration and it still works.

            Did you mean to modify the existing module to upgrade existing Jackson to a newer one (which I need)? But in those modules even java package names are different..so not sure..

            • 3. Re: How to register own JSON Transformer?
              kcbabo

              Oh yeah, I forgot that Jackson changed its package names between 1.x and 2.x.  If the package names are different, then you should be fine with having both versions in the class path.  The only exception to this would be if there was a resource that had the same path/name between versions (e.g. a .properties file) - you could then hit an issue where the code was loaded out of the newer module and the properties file was loaded out of the older module.  I don't think this is the case with Jackson - just an FYI in general.