1

I am using flexjson for deserializing json string

My Classes are as follows :

public abstract class Content{
int id;}

public class LoyaltyProgram{
Content content;
//
}

How can i deserialize following json object

{"name":"TESTER123","resetFrequencyHours":"1","target":"5","totalCount":"5","content":138}

currently i m using flolowing code for deserializing :

new JSONDeserializer<LoyaltyProgram>()
    .use(null, LoyaltyProgram.class).deserialize(json);

This throws following error : [ content ]:There was an exception trying to instantiate an instance of content

Devloper
  • 120
  • 3
  • 14

1 Answers1

0

You need to extend Content with a concrete class.

public class SomeContent extends Content {
}

That said, from what I see, your Content class only contains an int field. Both your JSon object and your LoyaltyProgram should probably take int content instead of Content content as a parameter.

Angelo Alvisi
  • 480
  • 1
  • 4
  • 15