I was able to successfully download json in my gradle dependencies:
implementation 'org.json:json:20171018'
Answer from David Miller on Stack OverflowI was able to successfully download json in my gradle dependencies:
implementation 'org.json:json:20171018'
As some mentioned, mvnrepository provides snippet for different Build systems.
After you choose your desired version, in the middle of the page, select Gradle as build system, copy and paste the snippet in your build.gradle file, section dependencies in your java project.
// https://mvnrepository.com/artifact/org.json/json
compile group: 'org.json', name: 'json', version: '20180813'
junit - Gradle dependency json-simple error - Stack Overflow
How to add this library as gradle dependency for Android Studio?
JSON output of gradle dependencies
adding json dependency to a library module in android studio - Stack Overflow
If you download the JSON jar specified, and list its contents (e.g. with jar tf), it does not contain the org.json.simple package.
So the problem is simply that you need another jar.
EDIT:
I don't know if this is the intent, but an educated guess: if you add this dependency to build.gradle:
compile 'com.googlecode.json-simple:json-simple:1.1.1'
and these imports:
import org.json.simple.parser.*;
// import org.json.simple.*;
import org.json.*;
then the example compiles (for me).
Adding this to my build.gradle file works:
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
I had already installed json-simple-1.1.1.jar
I had already added this below to build.gradle and I use windows 10.
dependencies {implementation "G:\document\org.json:json:20171018" }
I still got the same error message: "The import org.json cannot be resolved".
@Baldy answer is the same as:
implementation 'com.fasterxml.jackson.core:jackson-core:2.10.1'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.10.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.10.1'
Following android studio conventions. You can find the up to date version at: Maven Central Repository.
Here's what have in my dependencies section in my build.gradle file for Jackson:
compile (
[group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.4.1'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.4.1'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.4.1']
)
If you're trying to use jax-rs, you'll also need a few more:
[group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-base', version: '2.4.1'],
[group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version: '2.4.1'],
[group: 'com.fasterxml.jackson.module', name: 'jackson-module-jaxb-annotations', version: '2.4.1']