public static <T> T fromJSON(final Class<T> targetClass, final String json) {
        if (targetClass.equals(JsonObject.class)) {
            return (T) JsonObject.from(N.fromJSON(Map.class, json));
        } else if (targetClass.equals(JsonArray.class)) {
            return (T) JsonArray.from(N.fromJSON(List.class, json));
        } else if (targetClass.equals(JsonDocument.class)) {
            final JsonObject jsonObject = JsonObject.from(N.fromJSON(Map.class, json));
            final String id = N.stringOf(jsonObject.get(_ID));

            jsonObject.removeKey(_ID);

            return (T) JsonDocument.create(id, jsonObject);
        } else {
            throw new IllegalArgumentException("Unsupported type: " + ClassUtil.getCanonicalClassName(targetClass));
        }
    }
public static < T > T fromJSON ( final Class < T > targetClass , final String json ) { if ( targetClass . equals ( JsonObject . class ) ) { return ( T ) JsonObject . from ( N . fromJSON ( Map . class , json ) ) ; } else if ( targetClass . equals ( JsonArray . class ) ) { return ( T ) JsonArray . from ( N . fromJSON ( List . class , json ) ) ; } else if ( targetClass . equals ( JsonDocument . class ) ) { final JsonObject jsonObject = JsonObject . from ( N . fromJSON ( Map . class , json ) ) ; final String id = N . stringOf ( jsonObject . get ( _ID ) ) ; jsonObject . removeKey ( _ID ) ; return ( T ) JsonDocument . create ( id , jsonObject ) ; } else { throw new IllegalArgumentException ( "Unsupported type: " + ClassUtil . getCanonicalClassName ( targetClass ) ) ; } }
Returns an instance of the specified target class with the property values from the specified JSON String.

@param targetClass <code>JsonArray.class</code>, <code>JsonObject.class</code> or <code>JsonDocument.class</code>
@param json
@return