如何在Java 7中使用org.json Java库

如何在Java 7中使用org.json Java库

问题描述:

我需要在我的应用程序中进行一些简单的JSON解析, Douglas Crockford库似乎正是我所需要的。

I need some simple JSON parsing in my application and the Douglas Crockford library seems exactly what I need.

但是,我似乎遇到了问题。我收到以下错误:

However, I seem to be running into a problem. I'm getting the following error:

线程main中的异常java.lang.UnsupportedClassVersionError:org / json / JSONObject:不支持的major。次要版本52.0

我搜索了一下,我得到的印象是这是由于某些版本不兼容。我试过改变Java版本,但似乎没有帮助。我在我的程序中使用Java 7和Java 7功能,最终我想使用Java 7.

I Googled around a bit and I get the impression that this is due to some version incompatibility. I've tried changing Java versions but it doesn't seem to help. I'm using Java 7 and Java 7 features in my program and ultimately I want to use Java 7.

如何解决此问题?

PS:我看过Jackson和GSON,绝对不想使用它们,所以请不要建议作为替代。

PS: I looked at Jackson and GSON and definitely don't want to use either so please don't suggest as an alternative.

您是否尝试过使用旧版本的软件包?

Have you tried using an older version of the package?

尝试: http://mvnrepository.com/artifact/org.json/json/20140107