I've seen a lot of post about how to parse JSON files using Gson library, but they all use root elements in order to do the Serialization. So, in that case, you don't have the root element.
Example (persons.json)
[
{
"name":"Paul",
"telephone": 5434523542,
"email": "paul@xd.com"
},
{
"name":"William",
"telephone": 23423520,
"email": "aijda@fns.com"
}
]
The JSON file have more than 1000 objects as the two represented above.
I defined a class named Person, like
Person.java
public class Person {
private String name;
private int phone;
private String email;
public Person(String name, int phone, String email) {
this.name = name;
this.phone = phone;
this.email = email;
}
So now, I want to get all the information on my main class using Gson library. How can I do it without root element?