*/
@SuppressWarnings("unchecked")
public static <T> T fromJSON(final String json, final Class<T> type, final Class<?> assumedMapKeyType,
final Class<?> assumedMapValueType) {
final EJValue parsedValue = ParserFactory.get().parse(json);
final MarshallingSession session = MarshallingSessionProviderFactory.getDecoding();
session.setAssumedMapKeyType(assumedMapKeyType.getName());
session.setAssumedMapValueType(assumedMapValueType.getName());
final Marshaller<Object> marshallerInstance = session.getMarshallerInstance(type.getName());
if (marshallerInstance == null) {
throw new RuntimeException("No marshaller for type: " + type.getName());
}
return (T) marshallerInstance.demarshall(parsedValue, session);
}