1

How can i map json to bean class with polymorphic data type i have three pattern of json statement

{
  actor:"ashok",
  verb:"completed"
} 

or this

  {
      actor:["ashok","kumar"],
      verb:{
          disp:"en-us",
          url:{
             link:"url",
             tag:"tagname"
          }
      }
  } 

or

{
      actor:{name:["ashok","kumar"],mail:["a@a.com","b@b.com"]}
      verb:{
          disp:"en-us",
          url:{
             link:"url",
             tag:"tagname"
          }
      }
  } 

how can i map all these type of json in same bean class. i need a polymorphic bean class which can handle all type of objects of json and also able to handle single sting data

Ashok kumar
  • 195
  • 10

1 Answers1

0

you can use the Gson. it provide fromJson() method.