Skip to content

JSON Java for Android developers

Sean Leary edited this page Jan 5, 2017 · 14 revisions

JSON-Java Compatibility: At the present time, JSON-Java maintains a level of Java JDK compatibility that allows it to be used by Android developers. This is not a project commitment, but it will be maintained for as long as possible.

Naming conflict with JSON-Java: The Android SDK already includes a subset of JSON-Java functionality. The Android package name is org.json, which conflicts with this project. Here are some workarounds:

  • If all you want is basic, no-frills functionality, with no recent bug fixes, then just use the built in Android package.
  • If you want to include the JSON-Java lib for functionality only found in JSON-Java. For example, XML-JSON transformations provided by XML.java and other classes, then this may result in run time errors due to the conflict between the built-in org.json package and the JSON-Java org.json package. In this case, you may wish to refactor the JSON-Java source and build/import a local version of JSON-Java with a different package name.
  • You may also wish to try the workaround found here: https://github.com/AppWerft/Ti.XML2Json/blob/master/android/src/de/appwerft/remotexml/JSON.java
Clone this wiki locally