{"action":"created","issue":{"url":"https://api.github.com/repos/lukas-krecan/JsonUnit/issues/132","repository_url":"https://api.github.com/repos/lukas-krecan/JsonUnit","labels_url":"https://api.github.com/repos/lukas-krecan/JsonUnit/issues/132/labels{/name}","comments_url":"https://api.github.com/repos/lukas-krecan/JsonUnit/issues/132/comments","events_url":"https://api.github.com/repos/lukas-krecan/JsonUnit/issues/132/events","html_url":"https://github.com/lukas-krecan/JsonUnit/issues/132","id":361522332,"node_id":"MDU6SXNzdWUzNjE1MjIzMzI=","number":132,"title":"JSONPath support is broken","user":{"login":"eximius313","id":5578017,"node_id":"MDQ6VXNlcjU1NzgwMTc=","avatar_url":"https://avatars0.githubusercontent.com/u/5578017?v=4","gravatar_id":"","url":"https://api.github.com/users/eximius313","html_url":"https://github.com/eximius313","followers_url":"https://api.github.com/users/eximius313/followers","following_url":"https://api.github.com/users/eximius313/following{/other_user}","gists_url":"https://api.github.com/users/eximius313/gists{/gist_id}","starred_url":"https://api.github.com/users/eximius313/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eximius313/subscriptions","organizations_url":"https://api.github.com/users/eximius313/orgs","repos_url":"https://api.github.com/users/eximius313/repos","events_url":"https://api.github.com/users/eximius313/events{/privacy}","received_events_url":"https://api.github.com/users/eximius313/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-09-18T23:34:16Z","updated_at":"2018-09-19T21:52:30Z","closed_at":"2018-09-19T15:07:36Z","author_association":"NONE","body":"According to http://jsonpath.com/ with given JSON `{\"myNode\":{\"inner\":\"foo\"}}` and JSONPath `$.myNode.inner` the result is `[ \"foo\" ]`\r\n\r\nBut \r\n```\r\nfinal String json = \"{\\\"myNode\\\":{\\\"inner\\\":\\\"foo\\\"}}\";\r\nassertThatJson(json).inPath(\"$.myNode.inner\").isArray();\r\n```\r\nthrows:\r\n```\r\njava.lang.IllegalArgumentException: Can not parse actual value., took 1.612 sec\r\n[error]     at net.javacrumbs.jsonunit.core.internal.Jackson2NodeFactory.readValue(Jackson2NodeFactory.java:59)\r\n[error]     at net.javacrumbs.jsonunit.core.internal.AbstractNodeFactory.readValue(AbstractNodeFactory.java:53)\r\n[error]     at net.javacrumbs.jsonunit.core.internal.AbstractNodeFactory.convertToNode(AbstractNodeFactory.java:31)\r\n[error]     at net.javacrumbs.jsonunit.core.internal.Converter.convertToNode(Converter.java:123)\r\n[error]     at net.javacrumbs.jsonunit.core.internal.JsonUtils.convertToJson(JsonUtils.java:50)\r\n[error]     at net.javacrumbs.jsonunit.core.internal.JsonUtils.convertToJson(JsonUtils.java:37)\r\n[error]     at net.javacrumbs.jsonunit.core.internal.JsonUtils.getNode(JsonUtils.java:89)\r\n[error]     at net.javacrumbs.jsonunit.core.internal.JsonUtils.nodeAbsent(JsonUtils.java:134)\r\n[error]     at net.javacrumbs.jsonunit.core.internal.JsonUtils.nodeAbsent(JsonUtils.java:105)\r\n[error]     at net.javacrumbs.jsonunit.core.internal.JsonUtils.nodeAbsent(JsonUtils.java:101)\r\n[error]     at net.javacrumbs.jsonunit.assertj.JsonAssert.isPresent(JsonAssert.java:189)\r\n[error]     at net.javacrumbs.jsonunit.assertj.JsonAssert.assertType(JsonAssert.java:180)\r\n[error]     at net.javacrumbs.jsonunit.assertj.JsonAssert.isArray(JsonAssert.java:109)\r\n```"},"comment":{"url":"https://api.github.com/repos/lukas-krecan/JsonUnit/issues/comments/422971171","html_url":"https://github.com/lukas-krecan/JsonUnit/issues/132#issuecomment-422971171","issue_url":"https://api.github.com/repos/lukas-krecan/JsonUnit/issues/132","id":422971171,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjk3MTE3MQ==","user":{"login":"eximius313","id":5578017,"node_id":"MDQ6VXNlcjU1NzgwMTc=","avatar_url":"https://avatars0.githubusercontent.com/u/5578017?v=4","gravatar_id":"","url":"https://api.github.com/users/eximius313","html_url":"https://github.com/eximius313","followers_url":"https://api.github.com/users/eximius313/followers","following_url":"https://api.github.com/users/eximius313/following{/other_user}","gists_url":"https://api.github.com/users/eximius313/gists{/gist_id}","starred_url":"https://api.github.com/users/eximius313/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eximius313/subscriptions","organizations_url":"https://api.github.com/users/eximius313/orgs","repos_url":"https://api.github.com/users/eximius313/repos","events_url":"https://api.github.com/users/eximius313/events{/privacy}","received_events_url":"https://api.github.com/users/eximius313/received_events","type":"User","site_admin":false},"created_at":"2018-09-19T21:52:30Z","updated_at":"2018-09-19T21:52:30Z","author_association":"NONE","body":"> It is not always an array for example\r\n> \r\n> `String json = \"{\\\"myNode\\\":{\\\"inner\\\":\\\"foo\\\"}}\"; assertThatJson(json).inPath(\"$.myNode.inner\").isString().isEqualTo(\"foo\");`\r\n\r\nAre you sure?\r\nIn my example: \r\n```\r\nfinal String json = \"{\\\"foo\\\":{\\\"bar\\\":{\\\"baz\\\":[{\\\"id\\\":\\\"hello\\\",\\\"value\\\":\\\"world\\\"}]}}}\";\r\n```\r\nThis pass: \r\n```\r\nassertThatJson(json).inPath(\"$.foo.bar.baz[?(@.id==\\\"hello\\\")].value\").isArray().containsExactly(\"world\"));\r\n```\r\nBut this fails:\r\n```\r\nassertThatJson(json).inPath(\"$.foo.bar.baz[?(@.id==\\\"hello\\\")].value).isString().isEqualTo(\"world\"));\r\n``` \r\nwith:\r\n```\r\nNode \"$.foo.bar.baz[?(@.id==\"hello\")].value\" has invalid type, expected: <string> but was: <[world]>\r\n```"}}
{"actor":{"display_login":"eximius313"}}