title: trailing characters getting parsed in json
body: <p>I am trying to check if json is valid and I am experiencing a bizzare behaviour.
  When I append some characters to a parsable json both jackson and gson are parsing it and they ignore the trailing charaters. I want to check if the json is strictly valid. Please help. I tried a couple of flags in <code>mapper.configure()</code> but I couldn't find the exact setting.  </p>
  
  <pre><code>import com.google.gson.JsonParser;
  import org.codehaus.jackson.map.DeserializationConfig;
  import org.codehaus.jackson.map.ObjectMapper;
  
  public class JSONUtil {
      public static void main(String[] args) {
          String jsonStr = "{\"outputValueSchemaFormat\": \"\",\"sortByIndexInRecord\": 0,\"sortOrder\":\"descending\"}opdfahf";
          System.out.println(JSONUtil.isValidJson(jsonStr));
      }
      public static boolean isValidJson(String str) {
          try {
               final ObjectMapper mapper  = new ObjectMapper();
               mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, true);
               mapper.readTree(str);
           System.out.println(str);
               new JsonParser().parse(str);
  
          } catch (Exception e) {
              return false;
          }
              return true;
          }
  }
  </code></pre>
  
  <p>PS: This question is different from <a href="https://stackoverflow.com/questions/10174898/how-to-check-whether-a-given-string-is-valid-json-in-java">this</a> because i have used the same code but it seems that either the library has some bug or some configuration flag is missing. I tried a couple of configuration flag but none seems to work.</p>