问题描述
这里我在我的eclipse项目中使用Jackson数据绑定器2.4.1 jar库将对象转换为json格式。这是我的代码:
Here I am using Jackson data binder 2.4.1 jar library in my eclipse project to convert an object to a json format. And here is my code:
ObjectMapper mapper = new ObjectMapper();
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
mapper.writeValue(wr, content);
但最后一行 mapper.writeValue(wr,content);
它会出现错误说
but in the last line mapper.writeValue(wr, content);
it gives an error saying
The type com.fasterxml.jackson.core.JsonGenerator cannot be resolved. It is indirectly referenced from required .class files
I have studied and found that when a jar file's class is dependent on another class which is unavailable then this type of error occurs. But from where I am using this code snippet there is no issue like this. But I have failed a lot of time by changing the JAR version but nothing solved this issue. How can I solve this, please help
推荐答案
您需要 jackson-databind
和 jackson-core
这篇关于com.fasterxml.jackson.core.JsonGenerator类型无法解析。它是从所需的.class文件间接引用的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!