Jackson 和 Gson 是否直接实现标准的 JSR-353?

Do Jackson and Gson directly implement the standard JSR-353?

我在网上找不到我的问题的答案(也许我搜索得不够好,因为我在这方面还是个新手)。

谁能告诉我 Jackson and Gson implement the standard JSR 353: Java™ API for JSON Processing。我想用标准代码来写。

This link 有回复(显然是 Jackson 的创始人),它基本上说 Jackson 没有实现 JSR:

Reply by Tatu Saloranta on January 26, 2014 at 8:21pm

I am not a big fan of JSR-353 (I consider it a big fail) and unless something drastic happens, Jackson core will not implement JSR-353. There is no benefit from data-binding to use it; both because implementations do not bring anything to table (none are particularly fast), nor implement all that databind needs (base64 encoding, multi-format support capabilities) -- and worst of all ALL existing (de)serializers would need to be rewritten use new, less capable API. And baseline for Jackson would need to become Java 8. So I see no upside.

However, the reverse is possible; it is possible to have a JSR-353 implementation based on Jackson streaming package, and this has been done already:

https://github.com/pgelinas/jackson-javax-json.

Or, to make Jackson capable of reading/writing JSR-353 JSON object types, a simple datatype module is needed. I wrote one a while back:

https://github.com/FasterXML/jackson-datatype-jsr353

So if Java developers end up following "the standard" track, Jackson can play along.

Google didn't (couldn't?) vote on the JSR, and I couldn't find anything on Gson's roadmap 或者暗示他们愿意遵守。

不,既没有本机实现此 API,也没有(据我所知)实现它的计划。就 JCP 标准而言,这是 DOA;它提供的内容非常少(简单的流式传输 API,根本没有数据绑定),而且除了为已实现的 JSR 集添加兼容性复选框外,任何人都没有实现它的动力。

https://github.com/pgelinas/jackson-javax-json/ 上有一个基于 Jackson 的 JSR-353 实现,但是,如果您真的认为将代码基于此 API 是个好主意。

tl;博士

使用:

更新

其他两个答案是正确的,但是已经过时了。正如他们所解释的那样,Jackson 没有直接实现任何 JSR。

但是:

所以您现在确实可以使用 Jackson 以外的 JSON 库编写标准代码。