简体   繁体   English

解析不完整的Json结构

[英]Parsing incomplete Json structure

I have a JSON structure that looks like: 我有一个JSON结构,看起来像:

 {
        "one": "value",
        "two": "value",
        "three": "value"
    }{
        "one": "value",
        "two": "value",
        "three": "value"
    }

Basically, it misses square brackets and commas. 基本上,它会省略方括号和逗号。 JSON objects needed to be put into array. JSON对象需要放入数组中。 Is there any chance to parse it using javax.json library? 有没有机会使用javax.json库对其进行解析? It is possible to extract only first JSON object, but what about others? 只能提取第一个JSON对象,但是其他对象呢?

您可以通过以下方式更改输入字符串以使其为有效的JSON:添加[开头, ]末尾,将}{替换为},{ ,或在}之后分割并分别解析每个对象并将其添加到列表中。

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

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