I have to read JSON values from the URL using a query parameter for GET request. I am using Tomcat latest in a Spring Boot project.
@RequestMapping(
value = "/values",
method = RequestMethod.GET,
headers = HttpHeaders.ACCEPT + "=" + MediaType.APPLICATION_JSON_VALUE,
produces = "application/json")
public ResponseEntity<String> myMethod(
@RequestParam(value="key") String jsonRequestString) {
//parse JSONString
//--
}
GET request to the URL
Url:- http://localhost:port/values?key={"org":"AA","points":[{"name":"xy","Measures":"343"}]}]
Throws java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
EDIT :- Sending JSON in original form leading me to nowhere, so working approach would be to send the JSON in an encoded form.