• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

javabin and json

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet that queries a solr database using solrj. The response from the solr server is in javabin format, which is the default. I would like to convert this output to json, and I'm wondering if there is a simple way to do it. Note that solrj does NOT allow json responses, so I cannot simply specify "wt=json" as I would if I were using the REST interface. I've scoured the web, and I haven't really found anything useful. Is there any help for me?

The reason this is important is because I already have a tested and reliable piece of javascript code that leverages json output, and if I can avoid rewriting this, it would be fantastic!

Thanks for any suggestion!
Bill
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like javabin is a proprietary format created by the Solr project. If they have any forums / support you might ask if they have any tools for translating to more open formats. Barring that, assuming you know how to translate the javabin format into regular Java, you could then use a typical JSON tool to re-translate it from Java to JSON. I think json.org has a library for Java, and there is another one named Jackson (http://wiki.fasterxml.com/JacksonHome) which I hear works well...
 
Marshal
Posts: 67279
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gson is another popular JSON library. But yes, you need to get the data into a normal Java class first.
 
William Alfred
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I think you are correct... I just wanted to make sure there was nothing simple and obvious that I was missing. This might be the best solution anyway, since I will be able to distill the glut of data I get from solr to the handful of fields that my application actually needs.

Not to get too far off-thread, but I opted for json-lib...

Thanks all!
 
Yes, my master! Here is the tiny ad you asked for:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!