Skip to content
This repository was archived by the owner on Nov 18, 2021. It is now read-only.
This repository was archived by the owner on Nov 18, 2021. It is now read-only.

Unable to parse array located at 3rd level of nested xml com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: BEGIN_OBJECT expected, but met NAME #29

@yuviabhi

Description

@yuviabhi

# Can't parse <subject> node data. Its giving following error,

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: BEGIN_OBJECT expected, but met NAME
Scopes: INSIDE_OBJECT>NAME>INSIDE_EMBEDDED_ARRAY>INSIDE_OBJECT>NAME>INSIDE_EMBEDDED_ARRAY>INSIDE_OBJECT>NAME>INSIDE_OBJECT
Closed tags: 'semester'/3
Token: null
Tokens queue: BEGIN_OBJECT, NAME, STRING, NAME, STRING, NAME, STRING, null
Values queue: semester, @semno, 2, @min_crd_req, 22, @cum_crd_req, 48, null

POJOs

public class specialisations {    
    @SerializedName("specialisation")
    private List<specialisation> specialisationList;
}

public class specialisation {
    @SerializedName("@dept")
    private String dept = "";
    @SerializedName("@coursecode")
    private String coursecode = "";
    @SerializedName("@coursename")
    private String coursename = "";
    @SerializedName("semester")
    private List<semester> semester;
}

public class semester {    
    @SerializedName("@semno")
    private String semno="";    
    @SerializedName("@min_crd_req")
    private String min_crd_req="";    
    @SerializedName("@cum_crd_req")
    private String cum_crd_req="";    
    @SerializedName("subject")
    private List<subject> subject;
}

public class subject {    
    @SerializedName("subno")
    private String subno="";    
    @SerializedName("subname")
    private String subname="";    
    @SerializedName("ltp")
    private String ltp="";    
    @SerializedName("crd")
    private String crd="";    
    @SerializedName("sub_type")
    private String sub_type="";
}

XML DATA :-

<specialisations>
        <specialisation dept="AT" coursecode="AT1" coursename="EMBEDDED">
                  <semester semno="1"  min_crd_req="26" cum_crd_req="26">
                             <subject>
                                      <subno>1</subno>
                                      <subname>A</subname>
                                      <ltp>1-1</ltp>
                                      <crd>12</crd>
                                      <sub_type>C</sub_type>
                             </subject>
                             <subject>
                              .....same as above........
                             </subject>
                             <subject>
                              .....same as above........
                             </subject>
                  </semester>
                  <semester semno="2"  min_crd_req="26" cum_crd_req="26">
                        .....same as above........
                  </semester>
        </specialisation>

        <specialisation dept="BT" coursecode="BT" coursename="BT">
              .....same as above........
        </specialisation>

        <specialisation dept="CT" coursecode="CT" coursename="CT">
              .....same as above........
        </specialisation>

        <specialisation dept="DT" coursecode="DT" coursename="DT">
              .....same as above........
        </specialisation>

</specialisations>

See error details, POJOs and XML content here :
https://drive.google.com/open?id=1Afj66c5ocjpd6E9lK3bJYg_R8XeQzPQlRRpkXJW7BMU

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions