I am using JsonPath-2.4.0.jar
and while trying to extract object type value from json getting different result.
String json="{\r\n \"array\": [\r\n 1,\r\n 2,\r\n 3\r\n ],\r\n \"boolean\": true,\r\n \"color\": \"gold\",\r\n \"null\": null,\r\n \"number\": 123,\r\n \"object\": {\r\n \"a\": \"b\",\r\n \"c\": \"d\"\r\n },\r\n \"string\": \"Hello World\",\r\n \"test\": {\r\n \"test2\": {\r\n \"test3\": \"hello\"\r\n }\r\n },\r\n \"test2\": {\r\n \"test2\": {\r\n \"test3\": \"hello\"\r\n }\r\n },\r\n \"teststring\": \"{\\\"test1\\\":\\\"abc\\\"}\"\r\n}";
Object str = JsonPath.read(json, "$.test");
System.out.println(str);
result:
{test2={test3=hello}}
why?How to get actual json object from JSON?
Thanks.