javajsonjarclasspath

Import json-simple from Maven failed


I'm practicing Java JSON programming using JSON-Simple on this site which says:

All the jars available in maven repo is supported.

UPDATE:

So I've now added the external maven library to project.

enter image description here

But I still can't get it work.

I tried

import com.googlecode.json-simple.JSONObject;

but got:

error: ';' expected
import com.googlecode.json-simple.JSONObject;
                          ^

Then I tried

import com.googlecode.json_simple.JSONObject;

but got:

error: package com.googlecode.json_simple.parser does not exist
import com.googlecode.json_simple.parser.JSONParser;
                                        ^

How to make it works?


Solution

  • I'm pretty sure you forgot to add external maven library to project. Check this out: enter image description here

    ...and enter: org.apache.clerezza.ext:org.json.simple:0.4