You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Sowmya V.B." <vb...@gmail.com> on 2011/07/20 16:58:13 UTC

Reading Solr's JSON

Hi All

Which is the best way to read Solr's JSON output, from a Java code?
There seems to be a JSONParser in one of the jar files in SolrLib
(org.apache.noggit..)...but I dont understand how to read the parsed output
in this.

Are there any better JSON parsers for Java?

S

-- 
Sowmya V.B.
----------------------------------------------------
Losing optimism is blasphemy!
http://vbsowmya.wordpress.com
----------------------------------------------------

Re: Reading Solr's JSON

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Wed, Jul 20, 2011 at 10:58 AM, Sowmya V.B. <vb...@gmail.com> wrote:
> Which is the best way to read Solr's JSON output, from a Java code?

You could use SolrJ - it handles parsing for you (and uses the most
efficient binary format by default).

> There seems to be a JSONParser in one of the jar files in SolrLib
> (org.apache.noggit..)...but I dont understand how to read the parsed output
> in this.

If you just want to deserialize into objects (Maps, Lists, etc) then it's easy:

ObjectBuilder.fromJSON(my_json_string)

-Yonik
http://www.lucidimagination.com