/** * Parses a JSON string and constructs a corresponding Java object by calling the methods of a {@link org.bson.BSONCallback * BSONCallback} during parsing. If the callback {@code c} is null, this method is equivalent to {@link JSON#parse(String) * parse(String)}. * * @param s the string to parse * @param c the BSONCallback to call during parsing * @return a Java object representing the JSON data * @throws JSONParseException if s is not valid JSON */ public static Object parse(final String s, final BSONCallback c) { if (s == null || (s.trim()).equals("")) { return null; } JSONParser p = new JSONParser(s, c); return p.parse(); }
/** * Parses a JSON string and constructs a corresponding Java object by calling the methods of a {@link org.bson.BSONCallback * BSONCallback} during parsing. If the callback {@code c} is null, this method is equivalent to {@link JSON#parse(String) * parse(String)}. * * @param s the string to parse * @param c the BSONCallback to call during parsing * @return a Java object representing the JSON data * @throws JSONParseException if s is not valid JSON */ public static Object parse(final String s, final BSONCallback c) { if (s == null || (s.trim()).equals("")) { return null; } JSONParser p = new JSONParser(s, c); return p.parse(); }