title: How to pass data from one path to another in Spring
body: <p>I have a list of locations that I send as a JSON to one path:</p>
  
  <pre><code>@RestController
  public class Controller {
  
      List&lt;GeoLoc&gt; list = new ArrayList&lt;GeoLoc&gt;();
      @RequestMapping(
              value = "/myjson/{arraySize}")
      @ResponseBody
      public List&lt;GeoLoc&gt; createJSON(@PathVariable("arraySize") int arraySize)
  </code></pre>
  
  <p>So on the path localhost:8080/myjson/somenumber I will have a list of JSONs.</p>
  
  <p>But then, I would like to get that data from other method and path so that instead of JSON structure like this: {ID:1, town: "New York"} I got something like 1, New York. Basically plain String with comas, but I want that to be under other path, for example /myStrings. How could I make that request to read data from one path, change it and put into the another path? The @GetMapping changes my localhost:8080/myjson instead of just reading.</p>
  
  <p>Thanks in advance.</p>