Comments (3)
cc @petrdvorak Hi, this is a fork attempting to pick up where Unirest left off.
The problem here is twofold:
- Unirest does not come with a json ObjectMapper, you have to supply that, it only has the original org.json package
- TypeReference is a Jackson thing and isn't standard java. In gson they use TypeToken to do the same thing, Spring similarly has yet another of this famous hack.
Still there may be a way to pass one through to the Object Mapper. I'll take a look. If we can do it without taking sides then we will.
from unirest-java.
While I understand this might require a wider community consensus, looking into the docs, I wouldn't mind having Guava (that provides own TypeToken
class) as a provided dependency for Unirest. We add it in all our projects anyway...
If having the extra dependency is an issue, just adding this topic in documentation would help - I remember I spent too much time when dealing with this issue for the first time. (Currently, we have it resolved in our projects.)
from unirest-java.
Hi @petrdvorak, sorry this has taken a while to get to. I ended up implementing my own Generic Type Reference. You can see how it's used here:
This can be used with either Jackson like this:
https://github.com/OpenUnirest/unirest-java/blob/master/src/test/java/io/github/openunirest/http/JacksonObjectMapper.java#L44-L50
Or I suspect with any number of other mapping libraries.
2.4.00 should be in mvn central in about 20 minutes
from unirest-java.
Related Issues (20)
- Don't parse the body until getBody is called
- IllegalThreadStateException under high load HOT 13
- Unable to set custom HttpClient HOT 3
- Make httpasyncclient dep optional HOT 1
- Replace Apache Client with Java HTTP/2 client if Java adoption >=9 ever becomes a thing
- [Query] Coding Standard/Quality Used #209 HOT 4
- Why "asJson" cannot be resolved? HOT 6
- [DepShield] (CVSS 5.9) Vulnerability due to usage of com.google.guava:guava:24.0-jre HOT 1
- OutOfMemoryError on large file download on asBinary HOT 4
- How to get Response Body on server error HOT 5
- ClientFactory does not create a CloseableHttpAsyncClient with Encoding support HOT 13
- Unirest.config().setRequestHeader adds header instead of setting it HOT 14
- SSL - Server Name Indication problem HOT 4
- Headers has size() but no way to enumerate over them
- Headers in original order, please HOT 7
- Support for weird HTTP verbs, please HOT 2
- Non-static config HOT 4
- org.apache.http.NoHttpResponseException HOT 2
- Problems with UTF-8 encoding HOT 7
- OpenUnirest is Merging with kong/Unirest
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unirest-java.