How to convert object to query string with spring (or anything else)?

// object to Map
ObjectMapper objectMapper = new ObjectMapper();
Map map = objectMapper.convertValue(obj, new TypeReference>() {});

// Map to MultiValueMap
LinkedMultiValueMap linkedMultiValueMap = new LinkedMultiValueMap<>();
map.entrySet().forEach(e -> linkedMultiValueMap.add(e.getKey(), e.getValue()));

// call RestTemplate.exchange
return getRestTemplate().exchange(
        uriBuilder().path("your-path").queryParams(linkedMultiValueMap).build().toUri(),
        HttpMethod.GET,
        null,
        new ParameterizedTypeReference>() {}).getBody();

use com.sun.jersey.api.client.Client:

Client.create().resource("url").queryParam(key, value).get()