简体   繁体   English

除了aeson还有什么?

[英]How else but aeson?

aeson seems to take a somewhat simple-minded approach to parsing JSON: it parses a top-level JSON value (an object or array) to its own fixed representation and then offers facilities to help users convert that representation to their own. aeson似乎采用了一种有点简单的方法来解析 JSON:它将顶级 JSON 值(对象或数组)解析为它自己的固定表示,然后提供帮助用户将该表示转换为他们自己的表示的工具。 This approach works pretty well when JSON objects and arrays are small.当 JSON 对象和数组很小时,这种方法非常有效。 When they're very large, things start to fall apart, because user code can't do anything until JSON values are completely read and parsed.当它们非常大时,事情开始分崩离析,因为在完全读取和解析 JSON 值之前,用户代码无法执行任何操作。 This seems particularly unfortunate since JSON seems to be designed for recursive descent parsers— it seems like it should be fairly simple to allow user code to step in and say how each piece should be parsed.这似乎特别令人遗憾,因为 JSON 似乎是为递归下降解析器设计的——允许用户代码介入并说明应该如何解析每个部分似乎应该相当简单。 Is there a deep reason aeson and the earlier json work this way, or should I try to make a new library for more flexible JSON parsing? aeson和较早的json这种方式工作是否有深层原因,还是应该尝试创建一个新库以进行更灵活的 JSON 解析?

json-stream is a stream based parser. json-stream是一个基于流的解析器。 This is a bit out of date (2015), but they took the benchmarks from aeson and compared the two libraries: aeson and json-stream performance comparison .这有点过时(2015 年),但他们采用了aeson的基准并比较了两个库: aeson 和 json-stream 性能比较 There is one case where json-stream is significantly worse than aeson .有一种情况json-stream明显比aeson差。

If you just want a faster aeson (not streaming), haskell-sajson looks interesting.如果你只是想更快的aeson (不流),哈斯克尔-sajson看起来很有趣。 It wraps a performant C++ library in Haskell and returns Value from aeson .它在 Haskell 中包装了一个高性能的 C++ 库,并从aeson返回Value

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM