我如何使用pojo class将无效的json解析为java对象
我不确定此对象的格式是什么格式,但是我可以将以下无效的JSON对象解析为Java类POJO吗?我尝试使用杰克逊这样做,但是由于它无效,所以我想知道Pojo课程是否有效?
{
name: (sindey, crosby)
game: "Hockey"
type: athlete
}
该文件将具有此格式的多个对象
I'm not sure what format this object is in but can I parse the following invalid JSON object to Java class Pojo? I tried doing it using Jackson but since it's invalid, I was wondering if pojo class would work?
{
name: (sindey, crosby)
game: "Hockey"
type: athlete
}
The file would have multiple objects of this format
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Geesh,不要识别这种格式!如果您想使用杰克逊 =>
$ 1:“ $ 2”
当然,您可以通过简单的解析器来完成该工作。有足够的改进空间,但是类似的事情可以做到:
Geesh, don't recognise this format! If you want to use Jackson you could pre-process you data to wrap the values... perhaps a regex to catpure the groups and wrap the values in quotes something like
(name|type):\s(.+)
=>$1: "$2"
Sure, you could make that work with a simple parser; plenty of room for improvement, but something like this would do it: