@param string $json
@param array $context

@return mixed
@throws DecodingException
345328
protected static function decode($json, array $context)
    {
        $result = json_decode(
            $json,
            $context['json_decode_assoc'],
            $context['json_decode_depth'],
            $context['json_decode_options']
        );

        if (null === $result) {
            static::throwDecodingExceptionIfOccurred($json);
        }

        return $result;
    }
1209306
public function decode($data, $format, array $context = array())
    {
        $value = Encoder::decode($data, Encoder::TYPE_ARRAY);

        return $value;
    }
875437
public static function decode($json, $assoc = FALSE)
  {
    $json = utf8_encode($json);
    $json = str_replace(array("\n","\r"),"",$json);
    $json = preg_replace('/([{,])(\s*)([^"]+?)\s*:/','$1"$3":',$json);
    return json_decode($json,$assoc);
  }
12021
public static function json2arr($json)
    {
        $result = json_decode($json, true);
        if (empty($result)) {
            throw new InvalidResponseException('invalid response.', '0');
        }
        if (!empty($result['errcode'])) {
            throw new InvalidResponseException($result['errmsg'], $result['errcode'], $result);
        }
        return $result;
    }
429355
public static function get_Json( &$json )
    {
        if( $json instanceof Json ) {
            return $json;
        }
        return !is_null($json)
            ? new Json($json)
            : null
            ;
    }
441310
public static function error($json)
    {
        $fields = Deserialize::_fromJson($json);

        $result = new Api\Error();
        $result->setCode($fields->code);
        $result->setText($fields->text);

        return $result;
    }
1319037
private static function _fromJson(&$json)
    {
        $fields = json_decode($json);

        if (is_null($fields)) {
            throw new UnexpectedResponseException(
                json_last_error_msg(),
                $json
            );
        }

        return $fields;
    }
1270510
public function encode($data, $format, array $context = [])
    {
        $jsonEncodeOptions = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS];
        $encodedJson = json_encode($data, $jsonEncodeOptions);

        if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($jsonEncodeOptions & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
            throw new NotEncodableValueException(json_last_error_msg());
        }

        return $encodedJson;
    }
1178951
protected function jsonDecode($json)
    {
        $content = json_decode((string) $json, true);
        $this->handleJsonError(json_last_error());
        
        return $content;
    }
306963
public function jsonLDSerialize(string $context = self::DEFAULT_CONTEXT, bool $types = NULL)
    {
        return array_map(function($m) use ($context, $types) {
            return $m->jsonLDSerialize($context, $types ?? true); 
        }, $this->members);
    }
268924
protected function checkJsonObjectOrArray(\SwaggerValidator\Common\Context $context, &$jsonData)
    {
        if (is_object($jsonData) && !($jsonData instanceof \stdClass)) {
            $context->throwException('Mismatching type of JSON Data received', get_class($this) . '::' . __METHOD__, __LINE__);
        }
        elseif (!is_object($jsonData) && !is_array($jsonData)) {
            $context->throwException('Mismatching type of JSON Data received', get_class($this) . '::' . __METHOD__, __LINE__);
        }

        if (is_array($jsonData)) {
            parent::setJSONIsArray();
        }

        return true;
    }
159083
public function decode(string $json, bool $assoc = null, int $depth = null, int $options = null)
    {
        list($content, $error) = $this->softDecode($json, $assoc, $depth, $options);
        if ($error !== null) {
            throw $error;
        }
        return $content;
    }
1085673
public function jsonDecode($json, $assoc = false)
    {
        // if json_decode exists use that
        if (extension_loaded('json') && function_exists('json_decode')) {
            $decodedValue = json_decode($json, $assoc);
            if (!empty($decodedValue)) {
                return $decodedValue;
            }
        }

        try {
            return \Zend\Json\Decoder::decode(
                $json,
                $assoc
                    ? \Zend\Json\Json::TYPE_ARRAY
                    : \Zend\Json\Json::TYPE_OBJECT
            );
        } catch (Exception $exception) {
            // if a string is no valid json this call will throw Zend\Json\Exception\RuntimeException
            return null;
        }
    }
954032
protected static function decode($data, array $context)
    {
        if ($context['base64_decode_url_safe']) {
            $data = static::getUrlSafeData($data);
        }

        $result = base64_decode($data, $context['base64_decode_strict']);

        if (false === $result) {
            static::throwDecodingException($data);
        }

        return $result;
    }
372552
public static function fromJson(string $json): self
    {
        $input = json_decode($json, true);
        $data = reset($input);
        $locale = key($input);
        
        return new self($locale, $data);
    }
110962
@SuppressWarnings("unused")
  public static CarmenContext fromJson(@NonNull String json) {
    Gson gson = new GsonBuilder()
      .registerTypeAdapterFactory(GeocodingAdapterFactory.create())
      .create();
    return gson.fromJson(json, CarmenContext.class);
  }
304181
public static <T extends Context<T>> T deserialize(JsonObject context) {
    return deserialize(context.getString("uri"), context.getObject("context"));
  }