Access Json content with retrofit

0

How can I access the content of a JSON if retrofit 2 is used, the pratron observable and has the following structure:

Json:
    status: bool
    content[
        edTitle
        navUrl
        family
        type
        section
        edSummary
        id

        images[
            header
            kind
            url
            snap
            alt
            caption
            id
        ]

    ]


Json Original
"arreglo sin nombre"[

    status
    language
    isbn
    publication
    periodicity
    title
    webpage

    content[
        [
            uid
            family
            series
            abstract
            images[
                id
                page
                title
                section
                edSummary
                edTitle
                navUrl
            ]
        ]
    ]

    culture
    alias
    scope
    contentkind
    region
]

I have already configured the Base URL and the rest that are concatenated to access the json, but I can not modify the setter and getter that give these attributes

ContanierNote.java

public interface JornadaMovilAPI {
    @Headers("Cache-Control:no-cache")
    @GET("ultimas/app-principal.json")
    Observable<List<ContainerMobil>> getPortada();
}

public class ContainerMobil
{
    private MobilNote noticia;
    private List<MobilNote> content;

    public List<MobilNote> getContent()
    {
        return content;
    }

    public void setContent(List<MobilNote> content)
    {
        this.content = content;
    }
}

MovilNote.java

public class MobilNote implements Note {
    @SerializedName(value = "uuid_salida",alternate ={"uuid","uid","id"} )
    private String uuid;

    @SerializedName(value = "title" , alternate ={"edTitle"})
    private String title;
    @SerializedName("edSummary")
    private String description;
    @SerializedName(value = "urlSalida", alternate = {"absolute_url","site_url", "url", "navUrl"})
    private String url;

    @SerializedName(value = "sectionName", alternate = {"section"} )
    private String seccionName;

    private boolean isFormatUrl = false;

    private transient Section section;

    @SerializedName("images")
    private List<ImageNote> images;

    private ImageContainer container;

    @Override
    public String getTitle() {
        return title;
    }

    @Override
    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public ImageContainer getContainer() {
        if(container == null){
            container = new ImageContainer();
            for(ImageNote image:images){
                container.add(image);
            }
        }
        return container;
    }

    public void setContainer(ImageContainer container) {
        this.container = container;
    }

    public Section getSection() {
        if(section == null){
            section = new Section();
            section.setTitle(seccionName);
        }
        return section;
    }

    @Override
    public ImageContainer getImagesContainer() {
        return getContainer();
    }

    @Override
    public String getId() {
        if(url != null) {
            String urlData[] = url.split("/");
            return urlData[urlData.length-1];
        }
        return null;
    }
}

If I show the url with the previous format it shows me the information correctly, but I can not make the new json compatible

    
asked by bitByte 24.07.2018 в 16:54
source

0 answers