Is there a streaming API for JSON?

kal picture kal · Jan 14, 2009 · Viewed 72.2k times · Source

Is DOM the only way to parse JSON?

Answer

StaxMan picture StaxMan · May 5, 2009

Some JSON parsers do offer incremental ("streaming") parser; for Java, at least following parsers from json.org page offer such an interface:

(in addition to Software Monkey's parser referred to by another answer)

Actually, it is kind of odd that so many JSON parsers do NOT offer this simple low-level interface -- after all, they already need to implement low-level parsing, so why not expose it.

EDIT (June 2011): Gson too has its own streaming API (with gson 1.6)