Verifying if Key Values of Redis(Jedis) are JSON

I’m trying to make a Java program that iterate over Redis database, veryfing the key values; if it’s a valid JSON, extract into a separate schema(nothing done about this yet); else, do nothing, but keep searching over the other keys.

Here’s my function code:

Jedis jedis = new Jedis("localhost");

    ScanResult<String> scanResult = jedis.scan("0");
    List<String> keys = scanResult.getResult();
    String nextCursor = scanResult.getStringCursor();
    JSONParser parser = new JSONParser();
    int counter = 0;

    while(true) {

        if(nextCursor.equals("0")) {

        scanResult = jedis.scan(nextCursor);
        nextCursor = scanResult.getStringCursor();
        keys = scanResult.getResult();
        for(counter = 0; counter <= keys.size(); counter++) {
            try {
                JSONObject json = (JSONObject) parser.parse(keys.get(counter).toString());

            } catch (ParseException e) {
        System.out.println(keys = scanResult.getResult());

I’m getting trouble with JSON Parse (idk if I’m using him correctly) because I think I’m only getting the KEY NAMES (not their values).
I tried to use Map<String, String> = scanResult.getResult() instead of List<String>, but it point out a Typemismatch problem.

Seems like easy to solve, but I’m kinda stuck at this point… Any tip that could help will be welcome, thanks.