Killbean Posted April 13, 2021 Share Posted April 13, 2021 (edited) Hello guys, I am trying to parse json file with this formating: [ [ { "region": "Albania", .... } ], [ { "region": "Austria", ... } ] ] I am using MTA fromJson method. Whenever I want to get element by json[1].region I correctly get "Albania". Bud when I try json[2].region I get error. I will be glad for any help. Thanks! [ [{ "region":"Albánie", "male":["Aleks","Alesandro","Aron","Enrik","Flavio","Luis","Noel","Alban","Andi","Endri","Ermir","Arlind","Glen","Daniel","Erion","Lorik","Edi","Saimir","Vullnet","Orgest","Roland","Ferdinand","Neritan","Gazmir","Gersi","Genci"], "female":["Alesia","Anamaria","Greis","Klea","Sara","Sidorela","Uendi","Armela","Megi","Sindi","Drita","Albana","Kejsi","Adea","Anila","Suzana","Loreta","Alma","Arnisa","Adea","Besa","Adea","Dorina","Elvira","Entela","Enkelejda"], "surnames":["Bogdani","Dervishi","Dukagjini","Dushku","Frasheri","Gjoni","Gurakuqi","Hoxha","Leka","Loshi","Prifti","Baku","Kola","Zane","Musaj","Agolli","Brahimi","Kodra","Osmani","Myftiu","Xhafa","Dedja","Duro","Demiri","Shyti"] }], [{ "region":"Argentina", "male":["Agustín","Sebastian","Nicolas","Lautaro","Tomas","Lucas","Joaquín","Santiago","Federico","Juan","Juan Pablo","Andres","Thiago","Benjamín","Bautista","Franco","Francisco","Matías","Gabriel","Martín","Marcelo","Pablo","Gustavo","Hernan"], "female":["Sofía","Isabella","Jazmín","Mia","Juana","Martina","Morena","Uma","Lucía","María","Victoria","Laura","Agustina","Lucrecia","Florencia","Emma","Pamela","Cecilia","Carolina","Mariana","Luciana","Patricia"], "surnames":["Gonzalez","Rodríguez","Gomez","Fernandez","Lopez","Díaz","Martínez","Perez","García","Sanchez","Romero","alvarez","Torres","Ruiz","Ramírez","Flores","Acosta","Medina","Suarez","Herrera","Aguirre","Gimenez","Molina","Castro","Rojas","Ortiz","Nuñez","Juarez","Ríos","Godoy","Moreno","Peralta","Castillo","Ledesma","Ojeda","Villalba","Hernandez","Ramos","Arias","Maidana","Moyano","Campos","Soto","Montenegro","Leguizamon","Blanco"] }] ] Edited April 13, 2021 by Killbean Link to comment
Moderators Patrick Posted April 13, 2021 Moderators Share Posted April 13, 2021 Should look like this: [ [ { "region": "Albania" }, { "region": "Austria" } ] ] - Put an extra [ ] around your json. 1 Link to comment
Killbean Posted April 14, 2021 Author Share Posted April 14, 2021 @Patrickthank you! It worked. 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now