Question: I am using `Gson` to parse data from Json String. Everything is working fine.  

But now, Main `Json String` contains Inner Json String and I want that Inner `Json String`'s data. How to get it ?  

**Check my `Json String`:**

```
[{"Question":"Are you inclined to:","QId":"2","Options":[{"Option":"Argue or debate issues","OptionId":"4"},{"Option":"Avoid arguments","OptionId":"5"},{"Option":"Swutch topics","OptionId":"6"}]}]

```

**Here, I want value of "Options".  

My Sample code is as below :**

```
    PrimaryTest[] testlist = gson.fromJson(result, PrimaryTest[].class); // result is Json String.
    List<PrimaryTest> lstTest = Arrays.asList(testlist);
    PrimaryTest objTest = lstTest.get(0);
    String Question = objTest.getQuestion();

```

Here, I am getting Question value perfectly but don't know how to get Options value. If I am using same method then It is giving error : `Invalid Json Data`.
**PrimaryTest.java Code :**

```
public class PrimaryTest {

    private String Question;

    public PrimaryTest(String Question) {
        this.Question = Question;
    }

    public void setQuestion(String Question) {
        this.Question = Question;
    }

    public String getQuestion() {
        return this.Question;
    }
}

```

Answer: 
Write your class which include parameter which your JSON string contain so that you can directly parse your string into class object.  

Your `PrimaryTest` class should contain following members : 

```
public class PrimaryTest {  
    private String Question;  
    private int QId;  
    private List<Option> Options;  

    //Getter and Setter methods here
}  

```

And your `Option` class contain members as shown below : 

```
public class Option{  
   private String Option;  
   private int OptionId;  

   // Getter and Setter methods
}    

```

Now parse your JSON string in as `PrimaryTest` class and get your `Options` list from getter method of class. 

Below is the test code :

```
PrimaryTest[] response = gson.fromJson(json, PrimaryTest[].class);
List<PrimaryTest> lstTest = Arrays.asList(response);
PrimaryTest objTest = lstTest.get(0);

List<Option> options = objTest.getOptions();
for(Option option : options){
    System.out.println(option.getOption());
}

```
Hint an how the objects could be.

```
OptionClass{
String Option 
int/long OptionId
}

QuestionClass{
String Question
int/long QId
Collection<OptionClass> Options
}

```

Note: This is not a java class. Design your class based on the hints.