Except for any other suggestions, and depending on how JSON is formatted, you may have an option.
The problem mentioned in the Dzone article is that JSON does not have a leaf element that can be easily found when you go to the split point.
Now, if your JSON input has "pretty" or standard formatting, you can take advantage of this in your custom input implementation.
For example, taking a JSON sample from the Dzone example:
{ "results" : [ { "created_at" : "Thu, 29 Dec 2011 21:46:01 +0000", "from_user" : "grep_alex", "text" : "RT @kevinweil: After a lot of hard work by ..." }, { "created_at" : "Mon, 26 Dec 2011 21:18:37 +0000", "from_user" : "grep_alex", "text" : "@miguno pull request has been merged, thanks again!" } ] }
with this format, you know (hopefully?) that every new entry starts with a line that has 6 spaces and an open bracket. Recording ends in a similar format - 6 spaces and a closing bracket.
So, your logic in this case: use lines until you find a line with 6 spaces and an open bracket. Then buffer the contents until you find 6 spaces and a closing bracket. Then use any JSON deserializer that you want to turn into a java object (or just pass multi-line text to your cartographer.
source share