Fix ajax remote transfer error.
Fix can not convert object to array.
Replace drupal_json_output by JsonResponse.
Replace cache_set, cache_get and cache_clear_all by Drupal::cache().