{"action":"created","issue":{"url":"https://api.github.com/repos/smartrics/RestFixture/issues/128","labels_url":"https://api.github.com/repos/smartrics/RestFixture/issues/128/labels{/name}","comments_url":"https://api.github.com/repos/smartrics/RestFixture/issues/128/comments","events_url":"https://api.github.com/repos/smartrics/RestFixture/issues/128/events","html_url":"https://github.com/smartrics/RestFixture/issues/128","id":103283398,"number":128,"title":"Check JSON array","user":{"login":"Thaoden","id":3832723,"avatar_url":"https://avatars.githubusercontent.com/u/3832723?v=3","gravatar_id":"","url":"https://api.github.com/users/Thaoden","html_url":"https://github.com/Thaoden","followers_url":"https://api.github.com/users/Thaoden/followers","following_url":"https://api.github.com/users/Thaoden/following{/other_user}","gists_url":"https://api.github.com/users/Thaoden/gists{/gist_id}","starred_url":"https://api.github.com/users/Thaoden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Thaoden/subscriptions","organizations_url":"https://api.github.com/users/Thaoden/orgs","repos_url":"https://api.github.com/users/Thaoden/repos","events_url":"https://api.github.com/users/Thaoden/events{/privacy}","received_events_url":"https://api.github.com/users/Thaoden/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"smartrics","id":140858,"avatar_url":"https://avatars.githubusercontent.com/u/140858?v=3","gravatar_id":"","url":"https://api.github.com/users/smartrics","html_url":"https://github.com/smartrics","followers_url":"https://api.github.com/users/smartrics/followers","following_url":"https://api.github.com/users/smartrics/following{/other_user}","gists_url":"https://api.github.com/users/smartrics/gists{/gist_id}","starred_url":"https://api.github.com/users/smartrics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smartrics/subscriptions","organizations_url":"https://api.github.com/users/smartrics/orgs","repos_url":"https://api.github.com/users/smartrics/repos","events_url":"https://api.github.com/users/smartrics/events{/privacy}","received_events_url":"https://api.github.com/users/smartrics/received_events","type":"User","site_admin":false},"milestone":null,"comments":10,"created_at":"2015-08-26T14:30:33Z","updated_at":"2015-08-27T11:10:19Z","closed_at":"2015-08-27T03:44:08Z","body":"I want to check a JSON array like\r\n```\r\n[\r\n    {\r\n        \"Id\": 1,\r\n        \"Host\": {\r\n            \"Id\": 1,\r\n            \"LoginId\": \"abc\"\r\n        }\r\n    },\r\n    {\r\n        \"Id\": 2,\r\n        \"Host\": {\r\n            \"Id\": 3,\r\n            \"LoginId\": \"def\"\r\n        }\r\n    }\r\n]\r\n```\r\nIf the order of the elements was fixed, I would check for the host loginID like this: `jsonbody[0].Host.LoginId==\"abc\"`. However, the order isn't fixed (meaning element with ID 1 could appear at 2nd position).\r\nHow can I check for an occurrence anywhere in the array?"},"comment":{"url":"https://api.github.com/repos/smartrics/RestFixture/issues/comments/135387615","html_url":"https://github.com/smartrics/RestFixture/issues/128#issuecomment-135387615","issue_url":"https://api.github.com/repos/smartrics/RestFixture/issues/128","id":135387615,"user":{"login":"tigerqiu712","id":13540195,"avatar_url":"https://avatars.githubusercontent.com/u/13540195?v=3","gravatar_id":"","url":"https://api.github.com/users/tigerqiu712","html_url":"https://github.com/tigerqiu712","followers_url":"https://api.github.com/users/tigerqiu712/followers","following_url":"https://api.github.com/users/tigerqiu712/following{/other_user}","gists_url":"https://api.github.com/users/tigerqiu712/gists{/gist_id}","starred_url":"https://api.github.com/users/tigerqiu712/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tigerqiu712/subscriptions","organizations_url":"https://api.github.com/users/tigerqiu712/orgs","repos_url":"https://api.github.com/users/tigerqiu712/repos","events_url":"https://api.github.com/users/tigerqiu712/events{/privacy}","received_events_url":"https://api.github.com/users/tigerqiu712/received_events","type":"User","site_admin":false},"created_at":"2015-08-27T11:10:19Z","updated_at":"2015-08-27T11:10:19Z","body":"     [java] SlimTable.SlimTable table:[[Table:Rest Fixture, <a href=\"http://localhost:8001\">http://localhost:8001</a>], [let, spend, js, (%end% - %begin%) / 1000, ]]\r\n     [java] SlimTable.SlimTable table:[[Table:smartrics.rest.fitnesse.fixture.RestFixture, <a href=\"http://www.w3school.com.cn\">http://www.w3school.com.cn</a>], [GET, /example/xmle/note.xml, 200, Content-Type: text/xml, //body[text()=\"Don't forget the meeting!\"]]]\r\n     [java] SlimTable.SlimTable table:[[Table:smartrics.rest.fitnesse.fixture.RestFixture, <a href=\"http://www.w3school.com.cn\">http://www.w3school.com.cn</a>], [GET, /example/xmle/note.xml, 200, Content-Type: text/xml, /note/body[text()=\"Don't forget the meeting!\"]]]\r\n     [java] WARNING: error registered in test system [null]\r\n     [java] java.lang.NullPointerException\r\n     [java] \tat fitnesse.testsystems.slim.SlimCommandRunningClient.writeString(SlimCommandRunningClient.java:205)\r\n     [java] \tat fitnesse.testsystems.slim.SlimCommandRunningClient.invokeAndGetResponse(SlimCommandRunningClient.java:134)\r\n     [java] \tat fitnesse.testsystems.slim.SlimTestSystem.processTable(SlimTestSystem.java:123)\r\n     [java] \tat fitnesse.testsystems.slim.HtmlSlimTestSystem.processAllTablesOnPage(HtmlSlimTestSystem.java:51)\r\n     [java] \tat fitnesse.testsystems.slim.SlimTestSystem.runTests(SlimTestSystem.java:100)\r\n     [java] \tat fitnesse.testrunner.MultipleTestsRunner.executeTestSystemPages(MultipleTestsRunner.java:173)\r\n     [java] \tat fitnesse.testrunner.MultipleTestsRunner.startTestSystemAndExecutePages(MultipleTestsRunner.java:101)\r\n     [java] \tat fitnesse.testrunner.MultipleTestsRunner.internalExecuteTestPages(MultipleTestsRunner.java:86)\r\n     [java] \tat fitnesse.testrunner.MultipleTestsRunner.executeTestPages(MultipleTestsRunner.java:68)\r\n     [java] \tat fitnesse.responders.run.TestResponder.performExecution(TestResponder.java:273)\r\n     [java] \tat fitnesse.responders.run.TestResponder.doExecuteTests(TestResponder.java:121)\r\n     [java] \tat fitnesse.responders.run.TestResponder$TestExecutor.execute(TestResponder.java:205)\r\n     [java] \tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n     [java] \tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\r\n     [java] \tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n     [java] \tat java.lang.reflect.Method.invoke(Method.java:606)\r\n     [java] \tat org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)\r\n     [java] \tat org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)\r\n     [java] \tat org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)\r\n     [java] \tat org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)\r\n     [java] \tat org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:369)\r\n     [java] \tat org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)\r\n     [java] \tat org.apache.velocity.runtime.directive.Parse.render(Parse.java:260)\r\n     [java] \tat org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)\r\n     [java] \tat org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)\r\n     [java] \tat org.apache.velocity.Template.merge(Template.java:356)\r\n     [java] \tat org.apache.velocity.Template.merge(Template.java:260)\r\n     [java] \tat fitnesse.html.template.HtmlPage.render(HtmlPage.java:81)\r\n     [java] \tat fitnesse.responders.run.TestResponder.doSending(TestResponder.java:107)\r\n     [java] \tat fitnesse.responders.ChunkingResponder.startSending(ChunkingResponder.java:70)\r\n     [java] \tat fitnesse.http.ChunkedResponse.sendTo(ChunkedResponse.java:25)\r\n     [java] \tat fitnesse.FitNesseExpediter.sendResponse(FitNesseExpediter.java:100)\r\n     [java] \tat fitnesse.FitNesseExpediter.start(FitNesseExpediter.java:51)\r\n     [java] \tat fitnesse.FitNesseServer.serve(FitNesseServer.java:28)\r\n     [java] \tat fitnesse.FitNesseServer.serve(FitNesseServer.java:21)\r\n     [java] \tat fitnesse.socketservice.SocketService$ServerRunner.run(SocketService.java:110)\r\n     [java] \tat java.lang.Thread.run(Thread.java:745)\r\n     [java] WARNING: error registered in test system [null]\r\n     [java] java.lang.NullPointerException\r\n     [java] \tat fitnesse.testsystems.slim.SlimCommandRunningClient.writeString(SlimCommandRunningClient.java:205)\r\n     [java] \tat fitnesse.testsystems.slim.SlimCommandRunningClient.invokeAndGetResponse(SlimCommandRunningClient.java:134)\r\n     [java] \tat fitnesse.testsystems.slim.SlimTestSystem.processTable(SlimTestSystem.java:123)\r\n     [java] \tat fitnesse.testsystems.slim.HtmlSlimTestSystem.processAllTablesOnPage(HtmlSlimTestSystem.java:51)\r\n     [java] \tat fitnesse.testsystems.slim.SlimTestSystem.runTests(SlimTestSystem.java:100)\r\n     [java] SlimTable.SlimTable table:[[Table:smartrics.rest.fitnesse.fixture.RestFixture, <a href=\"http://www.w3school.com.cn\">http://www.w3school.com.cn</a>], [GET, /example/xmle/note.xml, 200, Content-Type: text/xml, //body[text()=\"Don't forget the meeting!\"]]]\r\n     [java] \tat fitnesse.testrunner.MultipleTestsRunner.executeTestSystemPages(MultipleTestsRunner.java:173)\r\n     [java] \tat fitnesse.testrunner.MultipleTestsRunner.startTestSystemAndExecutePages(MultipleTestsRunner.java:101)\r\n     [java] \tat fitnesse.testrunner.MultipleTestsRunner.internalExecuteTestPages(MultipleTestsRunner.java:86)\r\n     [java] SlimTable.SlimTable table:[[Table:smartrics.rest.fitnesse.fixture.RestFixture, <a href=\"http://www.w3school.com.cn\">http://www.w3school.com.cn</a>], [GET, /example/xmle/note.xml, 200, Content-Type: text/xml, /note/body[text()=\"Don't forget the meeting!\"]]]\r\n     [java] \tat fitnesse.testrunner.MultipleTestsRunner.executeTestPages(MultipleTestsRunner.java:68)\r\n     [java] \tat fitnesse.responders.run.TestResponder.performExecution(TestResponder.java:273)\r\n     [java] \tat fitnesse.responders.run.TestResponder.doExecuteTests(TestResponder.java:121)\r\n     [java] \tat fitnesse.responders.run.TestResponder$TestExecutor.execute(TestResponder.java:205)\r\n     [java] \tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n     [java] \tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\r\n     [java] \tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n     [java] \tat java.lang.reflect.Method.invoke(Method.java:606)\r\n     [java] \tat org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)\r\n     [java] \tat org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)\r\n     [java] \tat org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)\r\n     [java] \tat org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)\r\n     [java] \tat org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:369)\r\n     [java] \tat org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)\r\n     [java] \tat org.apache.velocity.runtime.directive.Parse.render(Parse.java:260)\r\n     [java] \tat org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)\r\n     [java] \tat org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)\r\n     [java] \tat org.apache.velocity.Template.merge(Template.java:356)\r\n     [java] \tat org.apache.velocity.Template.merge(Template.java:260)\r\n     [java] \tat fitnesse.html.template.HtmlPage.render(HtmlPage.java:81)\r\n     [java] \tat fitnesse.responders.run.TestResponder.doSending(TestResponder.java:107)\r\n     [java] \tat fitnesse.responders.ChunkingResponder.startSending(ChunkingResponder.java:70)\r\n     [java] \tat fitnesse.http.ChunkedResponse.sendTo(ChunkedResponse.java:25)\r\n     [java] \tat fitnesse.FitNesseExpediter.sendResponse(FitNesseExpediter.java:100)\r\n     [java] \tat fitnesse.FitNesseExpediter.start(FitNesseExpediter.java:51)\r\n     [java] \tat fitnesse.FitNesseServer.serve(FitNesseServer.java:28)\r\n     [java] \tat fitnesse.FitNesseServer.serve(FitNesseServer.java:21)\r\n     [java] \tat fitnesse.socketservice.SocketService$ServerRunner.run(SocketService.java:110)\r\n     [java] \tat java.lang.Thread.run(Thread.java:745)"}}