0

is there a way to extract string from this response ?

{"target":150740755136115,"placeholder_id":"postPlaceholder"}

I just need 150740755136115 please help

Temuujin
  • 47
  • 8

1 Answers1

2

You can do it using Jackson

private class MyPOJO {
    public String target;
    @JsonProperty("placeholder_id")
    public String placeholder;

    public MyPOJO(String target, String placeholder) {
        this.target = target;
        this.placeholder = placeholder;
    }
}

ObjectMapper mapper = new ObjectMapper();
MyPOJO data = mapper.readValue(yourJsonString, MyPOJO.class);

System.out.println(data.target);