简体   繁体   English

在java中解析复杂的JSON字符串

[英]Parsing complex string of JSON in java

I want to parse a JSON string which is quite complex. 我想解析一个非常复杂的JSON字符串。 It has somewhat following format 它有一些格式

           { A:{ list of around 20 objects},B:1}

These objects inside A again contains some other objects or the datatypes supported by JSON. A中的这些对象再次包含一些其他对象或JSON支持的数据类型。 I have checked couple of examples and documentations. 我查了几个例子和文件。

I found this example to be helpful Converting JSON to Java but looks like I need to know each and every element of the objects contained. 我发现这个例子很有帮助将JSON转换为Java,但看起来我需要知道包含的对象的每个元素。 I can write a similar code but before spending so much effort I wanted to check if there is other libraries out there which can do automatic parsing and By just giving the key field I can get those contents. 我可以写一个类似的代码,但在花了这么多精力之前我想检查是否有其他库可以进行自动解析,只需给出关键字段我就可以得到那些内容。

Jackson should be able to handle the structure with no problem. 杰克逊应该能够毫无问题地处理结构。 You do not need to know the exact structure of the JSON. 您不需要知道JSON的确切结构。 You can just iterate over all of the objects and inter-objects. 您可以迭代所有对象和对象。

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

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