{"action":"created","issue":{"url":"https://api.github.com/repos/ralfstx/minimal-json/issues/49","labels_url":"https://api.github.com/repos/ralfstx/minimal-json/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/ralfstx/minimal-json/issues/49/comments","events_url":"https://api.github.com/repos/ralfstx/minimal-json/issues/49/events","html_url":"https://github.com/ralfstx/minimal-json/pull/49","id":78420438,"number":49,"title":"A hybrid streaming API.","user":{"login":"sbandara","id":7516054,"avatar_url":"https://avatars.githubusercontent.com/u/7516054?v=3","gravatar_id":"","url":"https://api.github.com/users/sbandara","html_url":"https://github.com/sbandara","followers_url":"https://api.github.com/users/sbandara/followers","following_url":"https://api.github.com/users/sbandara/following{/other_user}","gists_url":"https://api.github.com/users/sbandara/gists{/gist_id}","starred_url":"https://api.github.com/users/sbandara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbandara/subscriptions","organizations_url":"https://api.github.com/users/sbandara/orgs","repos_url":"https://api.github.com/users/sbandara/repos","events_url":"https://api.github.com/users/sbandara/events{/privacy}","received_events_url":"https://api.github.com/users/sbandara/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-20T07:58:41Z","updated_at":"2015-05-28T03:30:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ralfstx/minimal-json/pulls/49","html_url":"https://github.com/ralfstx/minimal-json/pull/49","diff_url":"https://github.com/ralfstx/minimal-json/pull/49.diff","patch_url":"https://github.com/ralfstx/minimal-json/pull/49.patch"},"body":"Hi Ralf,\r\n\r\nTo address the feature request you posted and my own need for a streaming API, I created a branch \"streams\" and added a <code>CollectionFactory</code> interface to provide <code>JsonParser</code> with new instances of <code>JsonObject</code>,<code>JsonArray</code>, or custom implementations of an <code>ElementReader</code> or <code>MemberReader</code>, respectively.\r\n\r\nA client implementation of <code>CollectionFactory</code> may choose to return a custom <code>ElementReader</code> or <code>MemberReader</code>, depending on nesting level and/or field name of the most recent ancestor object. Those implementations will receive children JsonValue objects from the parser and can choose to filter them or otherwise extract content. Effectively, those minor changes would provide minimal-json with a streaming API, allowing clients to reduce their memory footprint.\r\n\r\nThe abstract factory methods so far only receive the nesting level and the field name of the closest ancestor, but we could also add line number and column offset to allow Angelo implement a schema reader. Let me know what you think...\r\n\r\nAdding those extensions, by the way, was very straightforward due to very clean design of your parser. Thank you so much for making minimal-json available for everyone!\r\n\r\nBest wishes,\r\nSam\r\n"},"comment":{"url":"https://api.github.com/repos/ralfstx/minimal-json/issues/comments/106159369","html_url":"https://github.com/ralfstx/minimal-json/pull/49#issuecomment-106159369","issue_url":"https://api.github.com/repos/ralfstx/minimal-json/issues/49","id":106159369,"user":{"login":"sbandara","id":7516054,"avatar_url":"https://avatars.githubusercontent.com/u/7516054?v=3","gravatar_id":"","url":"https://api.github.com/users/sbandara","html_url":"https://github.com/sbandara","followers_url":"https://api.github.com/users/sbandara/followers","following_url":"https://api.github.com/users/sbandara/following{/other_user}","gists_url":"https://api.github.com/users/sbandara/gists{/gist_id}","starred_url":"https://api.github.com/users/sbandara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbandara/subscriptions","organizations_url":"https://api.github.com/users/sbandara/orgs","repos_url":"https://api.github.com/users/sbandara/repos","events_url":"https://api.github.com/users/sbandara/events{/privacy}","received_events_url":"https://api.github.com/users/sbandara/received_events","type":"User","site_admin":false},"created_at":"2015-05-28T03:30:04Z","updated_at":"2015-05-28T03:30:04Z","body":"Here some added functionality for skipping stream content:\r\n* One element, *n* elements, or all elements can be skipped from the current array, by invoking <code>skipNext()</code>, <code>skipNext(n)</code>, or <code>skipAll()</code> on the <code>ParserContext</code> exposed in <code>createElementReader</code> or <code>addElement</code>.\r\n* <code>skipAll()</code> analogously can be used for skipping all remaining members of the current object, e.g. when all relevant members have been read. However, because members should be assumed unordered, invoking <code>skipNext()</code> or <code>skipNext(n)</code> from inside <code>createMemberReader</code> or <code>addMember</code> throws an <code>IllegalStateException</code>.\r\n* Entire arrays and objects - not only their content - can be skipped by returning <code>null</code> from the corresponding factory method depending on context properties. This means that the member or element of the *enclosing* collection is skipped.\r\n\r\nI don't think I should make more amendments. Looking forward to hear what you think. With the most recent changes there should be clear savings in object allocations, but I am also hoping that there is no noticeable overhead introduced. Let me know!"}}