Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the org.json Java library with Java 7

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:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/json/JSONObject : Unsupported major.minor version 52.0

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.

How can I resolve this issue?

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

like image 828
Luke Avatar asked Dec 08 '14 06:12

Luke


People also ask

What is the use of Org JSON?

json or JSON-Java is a simple Java based toolkit for JSON. You can use org. json to encode or decode JSON data.

What is JSON library in Java?

Json-io is a simple Java library to serialize/deserialize JSON.

Is JSON compatible with Java?

Technical Article. The Java API for JSON Processing provides portable APIs to parse, generate, transform, and query JSON. JSON (JavaScript Object Notation) is a lightweight, text-based, language-independent data exchange format that is easy for humans and machines to read and write.


1 Answers

Have you tried using an older version of the package?

Try: http://mvnrepository.com/artifact/org.json/json/20140107

like image 134
David ten Hove Avatar answered Oct 09 '22 03:10

David ten Hove