Have issues while reading a JSON String that I am building from BufferedReader and trying to assign the values to POJO class.
It works when I use this format (Discovered by accident. copy paste):
String build = {\"feature\":{\"id\":\"888888\",\"name\":\"A9 Refresh Release\"}
But actually when reading from the BufferedReader, it looks like below one:-
{"feature":{"id":"888888","name":"A9 Refresh Release"}}
Here is my code:
BufferedReader in = new BufferedReader(newInputStreamReader(connection.getInputStream()));
StringBuilder build = new StringBuilder();
String inputLine;
while ((inputLine = in.readLine()) != null) {
build.append(inputLine); }
in.close();
ObjectMapper mapper = new ObjectMapper();
Feature wrap = mapper.readValue(build, Feature.class);
My problem isn't that I don't know how to marshall JSON string to POJO but the JSON response which I am getting from my HttpURLConnection isn't valid for the ObjectMapper.