0

Below is my JSON format, currently my code is in the currencies, and has obtained the currency code successfully, but now i am stuck in terms on how to exit this array and go to languages object.

My current code basically obtains the name of the country, capital and region from the JSON code stuff attached. I also figured out for it to obtain the currency code, but now I want to get the languages part. This is all done within a while loop in java on AndroidStudio.

[
   {
      "name":"China",
      "topLevelDomain":[
         ".cn"
      ],
      "alpha2Code":"CN",
      "alpha3Code":"CHN",
      "callingCodes":[
         "86"
      ],
      "capital":"Beijing",
      "altSpellings":[
         "CN",
         "Zhōngguó",
         "Zhongguo",
         "Zhonghua",
         "People's Republic of China",
         "中华人民共和国",
         "Zhōnghuá Rénmín Gònghéguó"
      ],
      "subregion":"Eastern Asia",
      "region":"Asia",
      "population":1402112000,
      "latlng":[
         35.0,
         105.0
      ],
      "demonym":"Chinese",
      "area":9640011.0,
      "gini":38.5,
      "timezones":[
         "UTC+08:00"
      ],
      "borders":[
         "AFG",
         "BTN",
         "MMR",
         "HKG",
         "IND",
         "KAZ",
         "PRK",
         "KGZ",
         "LAO",
         "MAC",
         "MNG",
         "PAK",
         "RUS",
         "TJK",
         "VNM",
         "NPL"
      ],
      "nativeName":"中国",
      "numericCode":"156",
      "flags":{
         "svg":"https://flagcdn.com/cn.svg",
         "png":"https://flagcdn.com/w320/cn.png"
      },
      "currencies":[
         {
            "code":"CNY",
            "name":"Chinese yuan",
            "symbol":"¥"
         }
      ],
      "languages":[
         {
            "iso639_1":"zh",
            "iso639_2":"zho",
            "name":"Chinese",
            "nativeName":"中文 (Zhōngwén)"
         }
      ],
      "translations":{
         "br":"China",
         "pt":"China",
         "nl":"China",
         "hr":"Kina",
         "fa":"چین",
         "de":"China",
         "es":"China",
         "fr":"Chine",
         "ja":"中国",
         "it":"Cina",
         "hu":"Kína"
      },
      "flag":"https://flagcdn.com/cn.svg",
      "cioc":"CHN",
      "independent":true
   },
   {
      "name":"Macao",
      "topLevelDomain":[
         ".mo"
      ],
      "alpha2Code":"MO",
      "alpha3Code":"MAC",
      "callingCodes":[
         "853"
      ],
      "altSpellings":[
         "MO",
         "澳门",
         "Macao Special Administrative Region of the People's Republic of China",
         "中華人民共和國澳門特別行政區",
         "Região Administrativa Especial de Macau da República Popular da China"
      ],
      "subregion":"Eastern Asia",
      "region":"Asia",
      "population":649342,
      "latlng":[
         22.16666666,
         113.55
      ],
      "demonym":"Chinese",
      "area":30.0,
      "timezones":[
         "UTC+08:00"
      ],
      "borders":[
         "CHN"
      ],
      "nativeName":"澳門",
      "numericCode":"446",
      "flags":{
         "svg":"https://flagcdn.com/mo.svg",
         "png":"https://flagcdn.com/w320/mo.png"
      },
      "currencies":[
         {
            "code":"MOP",
            "name":"Macanese pataca",
            "symbol":"P"
         }
      ],
      "languages":[
         {
            "iso639_1":"zh",
            "iso639_2":"zho",
            "name":"Chinese",
            "nativeName":"中文 (Zhōngwén)"
         },
         {
            "iso639_1":"pt",
            "iso639_2":"por",
            "name":"Portuguese",
            "nativeName":"Português"
         }
      ],
      "translations":{
         "br":"Macau",
         "pt":"Macau",
         "nl":"Macao",
         "hr":"Makao",
         "fa":"مکائو",
         "de":"Macao",
         "es":"Macao",
         "fr":"Macao",
         "ja":"マカオ",
         "it":"Macao",
         "hu":"Makaó"
      },
      "flag":"https://flagcdn.com/mo.svg",
      "independent":false
   },
   {
      "name":"Taiwan",
      "topLevelDomain":[
         ".tw"
      ],
      "alpha2Code":"TW",
      "alpha3Code":"TWN",
      "callingCodes":[
         "886"
      ],
      "capital":"Taipei",
      "altSpellings":[
         "TW",
         "Táiwān",
         "Republic of China",
         "中華民國",
         "Zhōnghuá Mínguó"
      ],
      "subregion":"Eastern Asia",
      "region":"Asia",
      "population":23503349,
      "latlng":[
         23.5,
         121.0
      ],
      "demonym":"Taiwanese",
      "area":36193.0,
      "timezones":[
         "UTC+08:00"
      ],
      "nativeName":"臺灣",
      "numericCode":"158",
      "flags":{
         "svg":"https://flagcdn.com/tw.svg",
         "png":"https://flagcdn.com/w320/tw.png"
      },
      "currencies":[
         {
            "code":"TWD",
            "name":"New Taiwan dollar",
            "symbol":"$"
         }
      ],
      "languages":[
         {
            "iso639_1":"zh",
            "iso639_2":"zho",
            "name":"Chinese",
            "nativeName":"中文 (Zhōngwén)"
         }
      ],
      "translations":{
         "br":"Taiwan",
         "pt":"Taiwan",
         "nl":"Taiwan",
         "hr":"Tajvan",
         "fa":"تایوان",
         "de":"Taiwan",
         "es":"Taiwán",
         "fr":"Taïwan",
         "ja":"台湾(中華民国)",
         "it":"Taiwan",
         "hu":"Tajvan"
      },
      "flag":"https://flagcdn.com/tw.svg",
      "cioc":"TPE",
      "independent":true
   }
]
ADM
  • 20,406
  • 11
  • 52
  • 83

0 Answers0