You are here

WSEncoderJSON.php in Web Service Data 8

Same filename and directory in other branches
  1. 2.0.x src/Plugin/WSEncoder/WSEncoderJSON.php

File

src/Plugin/WSEncoder/WSEncoderJSON.php
View source
<?php

namespace Drupal\wsdata\Plugin\WSEncoder;

use Drupal\wsdata\Plugin\WSEncoderBase;
use Drupal\Component\Serialization\Json;

/**
 * String Encoder.
 *
 * @WSEncoder(
 *   id = "WSEncoderJSON",
 *   label = @Translation("JSON Encoder", context = "WSEncoder"),
 * )
 */
class WSEncoderJSON extends WSEncoderBase {

  /**
   * Encode JSON.
   */
  public function encode(&$data, &$replacements, &$url) {
    $data = Json::encode($data);
  }

}

Classes

Namesort descending Description
WSEncoderJSON String Encoder.