使用Java解析非严格的json,其中一个键没有用引号括起来 [英] parsing non-strict json, one in which keys are not enclosed in quotes, with Java

查看:328
本文介绍了使用Java解析非严格的json,其中一个键没有用引号括起来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解析一个字符串,该字符串仅以JSON格式表示键未用引号括起来。我可以很好地在Javascript中解析这个字符串,但是找不到可以帮助我解析它的Java API。我尝试的所有API都采用严格的JSON格式。

I am trying to parse a string which in JSON format only that keys are not enclosed in quotes. I can very well parse this string in Javascript, but can not find a Java API which will help me parse this. All the APIs I tried assumes strict JSON format.

任何人都可以建议一个可以解析这个问题的库,或者解决问题的全新方法(比如使用正则表达式)?

Can anyone suggest a library which has an option to parse this, or a whole new approach to the problem (say like use regex instead) ?

推荐答案

如果密钥没有用引号括起来那么它就不是JSON。

If the keys aren't enclosed in quotes then it's not JSON.

你应该或者自己破解或找到已经做过的人。

You should either hack this yourself or find someone who did it already.

此外,没有非严格的json 这样的东西。只有一个版本的JSON,它是严格的。

Also, there's no such thing as non-strict json. There's only 1 version of JSON and it's strict.

这篇关于使用Java解析非严格的json,其中一个键没有用引号括起来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆