• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

javabin and json

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Sheriff
Posts: 67682
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic