Here you can find the source of isValidJSON(final String json)
public static boolean isValidJSON(final String json)
//package com.java2s; //License from project: Apache License import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; public class Main { public static boolean isValidJSON(final String json) { boolean valid = false; try {/* w w w .ja v a2s. co m*/ ObjectMapper objectMapper = new ObjectMapper(); objectMapper.readTree(json); } catch (IOException e) { valid = false; } return valid; } }