Menu

Serialization of Enum Type in JSON lib 2.2

2009-01-24
2013-04-29
  • Vijay Mohan

    Vijay Mohan - 2009-01-24

    Hi guys,

      I am working with JSON oriented framework in Spring, we are using JSON lib to serialization of objects and collections.In my domain object i am having a ENUM type property. When i am map a JSON object to Bean object it is working fine(using toBean method), but i am sending back a Model Object to the client the ENUM not converting to JSON object, instead its showing ~unique~ for the corresponding property in the JSON object .

    If anybody having solution please share it here.

    I am using json-lib-2.2-jdk15.

    Thanks in advance

    Vijay Mohan

     
    • aalmiray

      aalmiray - 2009-01-30

      Hi Vijay,

      Have you tried registering an EnumMorpher? you could also register a custom morpher of your own to deal with this case if EnumMorpher is not enough.

      Cheers,
      Andres

       
    • aalmiray

      aalmiray - 2009-01-30

      Oops forgot to post a link to the faq where Enummorpher is shown

      http://json-lib.sourceforge.net/faq.html#enum

      Cheers,
      Andres

       

Log in to post a comment.