I am trying to get the data from firebase
using RestAPI. So i have integrated with Spring RestTemplate to receive the GET data. My json as below
{
"alanisawesome": {
"city": "US",
"name": "XYZ school"
},
"gracehop": {
"city": "CA",
"name": "ABC school"
},
"nextVal": {
"city": "Mumbai",
"name": "GHI School"
}
}
Since Firebase key(alanisawesome
,gracehop
,nextVal
) created automatically by firebase, I am unable to fetch based on the key.
My Spring Boot code is,
return restTemplate
.getForObject("https:<FIREBASE>.firebaseio.com/School.json",
School.class);
My model class is,
public class School {
private String name;
private String city;
// Getters and Setters
}