openHAB JSON library (not JSONPATH)


@Kai or anyone else who has experience in this area… I’m planning to do some investigative work on an API that requires JSON. Does openHAB (or any existing bindings) include libraries for constructing/consuming JSON? The reason I ask is that if I can get this proof of concept working outside of openHAB to start with then I hope to create a binding and I’d rather not have to completely rewrite the JSON construction parts to make it compatible.


I see the following libraries in the source tree…


Much appreciated Steve. Out of interest…which commands did you run to find that? Or did you check manually?

I used the following command from the top-level directory. This was from Cygwin on Windows but it would be the same command for Linux or Mac OS X.

find . -name '*json*.jar'

Wow, we have so many bindings that include json libs as jars…? That is not really nice…

@danielwalters86, I would like to add that openHAB 2 comes with GSON as a mandatory bundle (as it is used by the REST API). So when starting something new, my clear recommendation would be to use GSON as it is quite powerful, fast and would smoothly fit into openHAB 2 in future.

The Ecobee, Nest, Netatmo and possibly other bindings also use the Jackson libraries from, but they should be rewritten to use GSON when they are eventually ported over to OH2/ESH. Definitely go with GSON now (as the influxdb persistence bundle does already) because changing them out later will be a nuisance.

Thanks guys. Similarly is there a core HTTP library I should be using? Maybe the

According to, the recommendation for HTTP is the Jetty HTTP client library.