I'm trying to create a Kafka consumer in intellij but when I try to create the JsonParser it throws me an error :
JsonParser is abstract; cannot be instantiated 0
private static JsonParser jsonParser = new JsonParser(); private static String extractIdFromTweet(String tweetJson){ return jsonParser.parse(tweetJson) .getAsJsonObject() .get("id_str") .getAsString(); } I have tried:
- gson maven dependency
- org.json.simple.JSONObject
- org.json.JSONObject
but the error still persist.