protected function createCurrencyFromJson($json) {
    $currency_data = json_decode($json);

    $currency = new Currency();
    $currency->setCurrencyCode($currency_data->ISO4217Code);
    if (isset($currency_data->ISO4217Number)) {
      $currency->setCurrencyNumber($currency_data->ISO4217Number);
    }
    if (isset($currency_data->alternativeSigns)) {
      $currency->setAlternativeSigns($currency_data->alternativeSigns);
    }
    $currency->setLabel($currency_data->title);
    if (isset($currency_data->roundingStep)) {
      $currency->setRoundingStep($currency_data->roundingStep);
    }
    if (isset($currency_data->sign)) {
      $currency->setSign($currency_data->sign);
    }
    if (isset($currency_data->subunits)) {
      $currency->setSubunits($currency_data->subunits);
    }

    $usages_data = $currency_data->usage;
    $usages = [];
    foreach ($currency_data as $property => $value) {
      $this->$property = $value;
    }
    foreach ($usages_data as $usage_data) {
      $usage = new Usage();
      if (isset($usage_data->ISO8601From)) {
        $usage->setStart($usage_data->ISO8601From);
      }
      if (isset($usage_data->ISO8601To)) {
        $usage->setEnd($usage_data->ISO8601To);
      }
      if (isset($usage_data->ISO3166Code)) {
        $usage->setCountryCode($usage_data->ISO3166Code);
      }
      $usages[] = $usage;
    }
    $currency->setUsages($usages);

    return $currency;
  }