title: Get data as a JSON format in spring boot
body: <p>I want to build a request endepoints using spring boot: I have to consume restful api and convert that into another rest endpoint.</p>
  
  <p>I have a json Response on www.exampleapiurl.com/details</p>
  
  <pre><code>[{
        "name": "age",
        "value": "Child"
    },
  {
        "name": "recommendable",
        "value": true
      },
  
  {
        "name": "supported",
        "value": yes
      },
  ]
  [{
        "name": "age",
        "value": "Adult"
    },
  {
        "name": "recommendable",
        "value": true
      },
  
  {
        "name": "supported",
        "value": no
      },
  ]
  </code></pre>
  
  <p>I want the response to be:</p>
  
  <pre><code>[{
        "age": "Child"
    },
  {
        "recommendable": true
      },
  
  {
        "supported": "yes"
      },
  ]
  [{
        "age": "Adult"
    },
  {
        "recommendable": true
      },
  
  {
        "supported": "no"
      },
  ]
  </code></pre>
  
  <p>For this I have a attribute class with getter and setter:
  Attributes.class</p>
  
  <pre><code>@JsonIgnoreProperties(ignoreUnknown = true) 
  public class Attributes {
  private String age;
  private boolean recommendable;
  private String supported;
  
  getter and setter for these:
  }
  </code></pre>
  
  <p>This is my service.java class</p>
  
  <pre><code>@Service
  public class CService {
      private static RestTemplate restTemplate;
      public String url;
  
      @Autowired
      public CService(String url) {
          this.url = url;
      }
  
      public Attributes getAttributes() {
  
          HttpHeaders headers= new HttpHeaders();
          headers.add("Authorization", "some value");
          HttpEntity&lt;String&gt; request = new HttpEntity&lt;String&gt;(headers);
          ResponseEntity&lt;String&gt; response = restTemplate.exchange(url, HttpMethod.GET, request, Attributes.class);
          return response.getBody();
  
      }
  }
  </code></pre>
  
  <p>And this is my controller.class</p>
  
  <pre><code>@Controller
  public class CController {
      private CService cService;
      @Autowired
      public CController(CService cService) {
          this.cService = cService;
      }
  
      @RequestMapping(value="/example")
      @ResponseBody
      public Attributes getCAttributes() {
          return cService.getAttributes();    }  
  
  }
  </code></pre>
  
  <p>The Authorization is successful but,
  I am not getting any response for now</p>