question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hard dependency on Gson

See original GitHub issue

Config class holds a field private Optional<ObjectMapper> objectMapper = Optional.of(new JsonObjectMapper());

and JsonObjectMapper is based on Gson api and if Gson is missing in OSGi environment because most of the time we have Jackson, the class loading will fail. Of course we can install the Gson bundle into the OSGi runtime and it will work but when we already have Jackson present why would someone wants Gson.

I know there is an extension module available for Jackson but that does not remove the hard dependency on Gson, so a way to provide the kong.unirest.ObjectMapper implementation like kong.unirest.JacksonObjectMapper at runtime would be good to have.

There must be very good reasons to defaults to Gson but I still thought it is good to have a pluggable mechanism without a hard dependency on any JSON library.

JJWT - https://github.com/jwtk/jjwt has this approach, please have a look.

Thanks, Rakesh

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
rybercommented, Feb 12, 2022

This is complete as part of Unirest-4 which is in maybe the final release candidate, see https://github.com/Kong/unirest-java/discussions/429

2reactions
rybercommented, Feb 7, 2021

Tried hacking on this a bit since i t’s like -3 outside. This is going to be hard. What I outlined above isn’t going to work. I’m going to need to abstract out gson itself

Read more comments on GitHub >

github_iconTop Results From Across the Web

gson.JsonObject and class loading creating very odd situations
I've tried to isolate the classes so only the one jar file in the shared library directory is called (e.g., removing it from...
Read more >
How to Install GSON Module in Java? - GeeksforGeeks
Google GSON is a simple Java-based serialization/deserialization library to convert Java Objects into their JSON representation.
Read more >
Two ways to use Gson for JSON in Java - Twilio
If you're working in a statically-typed language like Java then dealing with JSON can be tricky. JSON doesn't have type definitions and is ......
Read more >
Parsing JSON using GSON within a Maven project in IntelliJ ...
This video is technology soup: I show how to create a Maven project within IntelliJ IDEA, bring in the GSON library, and use...
Read more >
com.google.code.gson - Maven Repository
Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found