Keep a stack of {'s and pop them when you get a }. Like a deterministic
pushdown automaton.On 1 April 2014 07:45, Gary Gregory <[email protected]> wrote: > I have a local patch for LOG4J2-583 to have the Log4j TCP and UDP socket > servers unmarhsal XML log events. > > This is "easy" for XML because when you have a stream of bytes and you > know its encoding, you can look for the end of an event by looking for its > closing tag: </Event>. Right now, my XML processing code, looks for the end > tag and feeds JAXB a substring from the buffer. Easy. Done. > > Not so much with JSON. You cannot use the same hack, there is no end tag. > All you have is an "end of object" closing bracket "}" which looks the same > as the closing marker for all other objects. > > So it looks like I would need to hook in a little deeper into a JSON > unmarshalling framework to extract each JSON log events as I see them. > > Any thoughts here? > > Gary > > -- > E-Mail: [email protected] | [email protected] > Java Persistence with Hibernate, Second > Edition<http://www.manning.com/bauer3/> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> > Spring Batch in Action <http://www.manning.com/templier/> > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory > -- Matt Sicker <[email protected]>
