How to get data from API URL from this in spring boot ? json array data not get?

Viewed 26

THIS is my code here ..

@RequestMapping(path="/QuestionExplorer", method =RequestMethod.POST)
public String AddStudent( Model m, HttpServletRequest request, HttpServletResponse response )
    throws IOException, InterruptedException{
String city = request.getParameter("fristName");
String key="my key here";

String ApiKey ="https://seo-google-suggestion.p.rapidapi.com/general/"+city;


HttpRequest request1 = HttpRequest.newBuilder()
.uri(URI.create(ApiKey))
        .header("X-RapidAPI-Key", key)
        .header("X-RapidAPI-Host", "seo-google-suggestion.p.rapidapi.com")
        .method("GET", HttpRequest.BodyPublishers.noBody())
        .build();
HttpResponse<String> response1 = HttpClient.newHttpClient().send(request1, HttpResponse.BodyHandlers.ofString());

System.out.println(response1.body());

m.addAttribute("Suggestion", response1.body());
    
 return "Questions";

}

This is console data ; ...........

how to get data infrom json array like this

  1. what : why digital transformation is important : why digital marketing

    [["what: "],["why: ",{"Suggestion":"why digital transformation is important","Url":"https://google.com/search?q=why digital transformation is important"}, {"Suggestion":"why digital marketing","Url":"https://google.com/search?q=why digital marketing"},{"Suggestion":"why digital marketing is important","Url":"https://google.com/search?q=why digital marketing is important"},{"Suggestion":"why digital transformation is essential for business growth","Url":"https://google.com/search?q=why digital transformation is essential for business growth"},{"Suggestion":"why digital marketing is important for small business","Url":"https://google.com/search?q=why digital marketing is important for small business"},{"Suggestion":"why digital transformations fail","Url":"https://google.com/search?q=why digital transformations fail"},{"Suggestion":"why digital license plates","Url":"https://google.com/search?q=why digital license plates"},{"Suggestion":"why digital camo","Url":"https://google.com/search?q=why digital camo"},{"Suggestion":"why digital literacy is important","Url":"https://google.com/search?q=why digital literacy is important"},{"Suggestion":"why digital citizenship is important","Url":"https://google.com/search?q=why digital citizenship is important"}],

0 Answers
Related