Java Is Json isJSONValid(String jsonInString)

Here you can find the source of isJSONValid(String jsonInString)

Description

is JSON Valid

License

Open Source License

Declaration

public static boolean isJSONValid(String jsonInString) 

Method Source Code


//package com.java2s;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;

public class Main {

    public static boolean isJSONValid(String jsonInString) {
        try {// w w w .  j a v a  2s  .  c o m
            final ObjectMapper mapper = new ObjectMapper();
            mapper.readTree(jsonInString);
            return true;
        } catch (IOException e) {
            return false;
        }
    }
}

Related

  1. isJSONEqual(M expectedJSON, N actualJSON)
  2. isJSONValid(final String json)
  3. isValidJSON(final String json)
  4. isValidJSON(final String json)
  5. isValidJSON(final String json)