推荐的 C 语言 JSON 解析器?
可能的重复:
用 C 解析 JSON 的最佳方法?
我需要解析、验证并在 C 应用程序中查询 JSON 数据,我正在寻找最佳 C JSON 库的建议。
数据将以字符串(char* UTF-8 数据)的形式输入,我首先需要对其进行验证以确保输入是有效的 JSON,然后我需要执行一些简单的查询(迭代数据)。
我不需要生成 JSON,我只需要使用它。我还更喜欢将整个文档加载到内存中的解析器,而不是 SAX 风格的解析器。
谁能推荐一个好的图书馆,或者有人有图书馆的经验或遇到过问题吗?
我在 JSON.org 上看到了 C 语言的库列表 - 这个列表中是否缺少任何好的库?
我的要求是拥有尽可能少的代码/运行时大小的小型库,以及宽松的 BSD/MIT 风格许可证,因为我的库将嵌入到其他应用程序中。
谢谢,
马克
Possible Duplicate:
Best Way To Parse JSON in C?
I need to parse, validate and query JSON data in a C application, and I am looking for recommendations for the best C JSON library.
The data will be input as strings (char* UTF-8 data), which I first need to validate to ensure the input is valid JSON, and then I will need to perform some simple queries (iterating over the data).
I do not need to produce JSON, I only need to consume it. I also would prefer a parser that will load the whole document into memory rather than a SAX-style parser.
Can anyone recommend a good library, or does anyone have any experience or had problems with libraries?
I have seen the list of libraries in C on JSON.org - are there any good libraries missing from this list?
My requirements are for a small library with as little code / runtime size as possible, and a permissive BSD/MIT style license, since my library will be embedded in other applications.
Thanks,
Marc
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我推荐 Jansson,我发现它非常容易使用(并且它将 JSON 加载到内存中)一次)。然而,我不太了解所有的选择,而且我也没有所有这些选择的工作经验。
I'm recommending Jansson, which I find quite easy to use (and which loads the JSON in memory at once). However, I don't know well all the alternatives, and I don't have a working experience of all of them.
我会选择 json-c 这是一个快速且易于使用的 JSON 解析器,用以下语言编写C.
I would choose json-c which is a fast and easy to use JSON parser written in C.