哪个 Haskell 包用于 JSON

发布于 2024-09-18 15:47:17 字数 100 浏览 3 评论 0原文

Hackage for Haskell 上大约有十几个 JSON 包。我如何知道应该使用哪个包?如何获得大众意见?

是否有关于哪个软件包被使用最多、下载最多等的统计数据?

There are about a dozen JSON packages on Hackage for Haskell. How do I know which package I should use? How do I get a popular opinion?

Are there any statistics on which package is being used the most, downloaded the most, etc.?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

同展鸳鸯锦 2024-09-25 15:47:17

我认为其他答案已经过时,今天它被广泛接受我认为 Haskell 中最好的 JSON 库和事实上的标准是 Aeson:

http://hackage.haskell.org/package/aeson

维护者是 Brian O'Sullivan,他以对 Haskell 的深入了解和以性能为导向的工作而闻名;毫无疑问,这是正确的选择。

此外,Aeson 还提供了一个非常好的 API,查看此示例

另外,我不知道过去,但现在 Yesod 也使用 Aeson:

http://hackage.haskell.org/packages/archive/yesod-json/1.1.0/doc/html/Yesod-Json.html
“使用 aeson 包”

http://www.yesodweb.com/book/json-web-service
“我们将使用 aeson 进行 JSON 解析和渲染”

The other answers are obsolete I think, today it is widely accepted I think that the best JSON library and the de-facto standard in Haskell is Aeson:

http://hackage.haskell.org/package/aeson

The maintainer is Brian O'Sullivan, known for his deep knowledge of Haskell and his performance-oriented work; there is no question it's the right choice.

In addition Aeson offers a very nice API, check this example.

Also, I don't know for the past but nowadays also Yesod uses Aeson:

http://hackage.haskell.org/packages/archive/yesod-json/1.1.0/doc/html/Yesod-Json.html
"using the aeson package"

http://www.yesodweb.com/book/json-web-service
"We'll be using aeson for JSON parsing and rendering"

樱花细雨 2024-09-25 15:47:17

根据其他人的依赖项进行选择

如果您使用新的 Haskell Web 框架之一,您可以考虑使用与该框架所使用的相同的 json 库。从反向依赖关系来看,配对似乎是:

  • Yesod: JSONb
  • Happstack: RJson
  • On-a-Horse: ???

很多包都使用 json

按功能选择

您还可以根据功能选择使用包。

如果您是 ByteStrings 的用户,请考虑使用 JSONb。它使用 AttoParsec 而不是通常的 Parsec,因此它可能会更快(但首先测量它)。

RJson 正在做一些巧妙的技巧 自动序列化嵌套记录

YAJL 提供了 yajl 的绑定,yajl 是一个用 C 编写的快速解析器。但要小心:原始的 yajl 是 BSD,但 Haskell YAJL 是 GPL-v3。

json 可能是一个安全的选择。

Choose by others' dependencies

If you use one of the new Haskell web frameworks, you may consider using the same json library as the framework is using. From the reverse dependencies it seems that the pairing is:

  • Yesod: JSONb
  • Happstack: RJson
  • On-a-Horse: ???

And a lot of packages use json.

Choose by features

You may also choose to use a package according to its features.

Consider using JSONb if you are a ByteStrings' user. It uses AttoParsec instead of the usual Parsec, so it might be faster (but measure it first).

RJson is doing some clever tricks to serialize nested records automatically.

YAJL offers bindings to yajl, a fast parser written in C. But be careful: the original yajl is BSD, but Haskell YAJL is GPL-v3.

json is, probably, a safe choice.

情愿 2024-09-25 15:47:17

根据此列表RJson 的下载频率高于 json,但 json 是迄今为止 Hackage 上其他库使用最多的库,有 77 个反向依赖(33 个直接依赖和 44 个间接依赖),而 5 个JSONb 第二个。

According to this list, RJson has been downloaded more often than json, but json is by far the most used by other libraries on Hackage, with 77 reverse dependencies (33 direct and 44 indirect), versus 5 for JSONb in second.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文