Create custom endpoints by extending the Resource Base class I created a custom endpoints by extending the core of Drupal. but I can not retrieve JSON data. I do not know what value to put in 'note: serialization_class

/** * Provides a resource to get bundles by entity.
*
* @RestResource(
*   id = "dna_custom_endpoint",
*   label = @Translation("DNA custom endpoint"),
*   serialization_class = ??????,
*   uri_paths = {
*     "canonical" = "/dnarest/{type}"
*   }
* )
*/


You know comprehensive guides that explain?

public function patch($type = 'type') {
    ???????
}


if you use what you said ( serialization_class = "Drupal\Core\Entity\Entity",) to me this generates fatal error PHP : 

Drupal\Core\Entity\Exception\NoCorrespondingEntityClassException: The Drupal\Core\Entity\Entity class does not correspond to an entity type. in Drupal\Core\Entity\EntityTypeRepository-&gt;getEntityTypeFromClass() (line 103 of /Applications/MAMP/htdocs/dnaphone/core/lib/Drupal/Core/Entity/EntityTypeRepository.php).
The serialization class is the input or output of normalization and denormalization, or in other words, the object that you get when you denormalize data or the object that you normalize on the way out. Drupal 8 core provides one example of this \Drupal\rest\Plugin\rest\EntityResource. If the object is an entity you can use core:

  serialization_class = "Drupal\Core\Entity\Entity",


In order to use your arbitrary non-entity, you would also probably need to implement a Normalizer, but that is possible as well.

If your goal is to create a non-REST API with a custom endpoint that does not correspond to a REST operation (such as login or getProperty), then you should look at the Services module.