Try parsing with native JSON extension first, since that's much faster.

@param string $json
@param \Closure $otherwise
@return mixed
@throws JsonException
509369
private function tryFallback(string $json, \Closure $otherwise)
    {
        if ($this->hasOption(Json5::FORCE_JSON5_DECODER)) {
            return $otherwise($json);
        }

        try {
            $decoder = new NativeJsonDecoder();
            $decoder->setOptions($this->getOptions());

            return $decoder->decode($json);
        } catch (JsonStackOverflowException | JsonEncodingException $e) {
            throw $e;
        } catch (\Throwable $e) {
            return $otherwise($json);
        }
    }
448392
private function updateResponseWithResults($json)
	{
		$response = $this->jsonToArray($json);

		if(isset($response['results'][0])) {
			$this->response = $response['results'][0];

			if(@$response['results'][0]['partial_match'] && $this->excludePartials) {
				throw new Exception(trans('location::errors.no_results'));
			}

			if(! $this->returnLocationData['country']) {
				$this->returnLocationData['country'] = $this->findInGoogleSet($response, ['country']);
				$this->returnLocationData['iso'] = $this->findInGoogleSet($response, ['country'], 'short_name');
			}

			if(! $this->returnLocationData['region']) {
				$this->returnLocationData['region'] = $this->findInGoogleSet($response, ['administrative_area_level_1']);
			}

			if(! $this->returnLocationData['city']) {
				$this->returnLocationData['city'] = $this->findInGoogleSet($response, ['administrative_area_level_2']);
			}

			if(! $this->returnLocationData['street']) {
				$this->returnLocationData['street'] = $this->findInGoogleSet($response, ['route']);
			}

			if(! $this->returnLocationData['street_number']) {
				$this->returnLocationData['street_number'] = $this->findInGoogleSet($response, ['street_number']);
			}

			if(! $this->returnLocationData['postal_code']) {
				$this->returnLocationData['postal_code'] = $this->findInGoogleSet($response, ['postal_code']);
			}

			if(! $this->returnLocationData['latitude']) {
				$this->returnLocationData['latitude'] = $response['results'][0]['geometry']['location']['lat'];
			}

			if(! $this->returnLocationData['longitude']) {
				$this->returnLocationData['longitude'] = $response['results'][0]['geometry']['location']['lng'];
			}
		}
        elseif(@$response['location']) {
            $this->returnLocationData['latitude'] = $response['location']['lat'];
            $this->returnLocationData['longitude'] = $response['location']['lng'];
        }
		else {
			throw new Exception(trans('location::errors.no_results'));
		}
	}
624402
private function decode($json)
  {
    $decodedResult = json_decode($json, true);
    if (JSON_ERROR_NONE != json_last_error()) {
      throw new ResponseDecodeException('JSON error: '.json_last_error_msg());
    }

    return $decodedResult;
  }
1336134
public static function moSms($json)
    {
        $fields = Deserialize::_fromJson($json);
        return Deserialize::_moSmsFromFields($json, $fields);
    }
1178951
protected function jsonDecode($json)
    {
        $content = json_decode((string) $json, true);
        $this->handleJsonError(json_last_error());
        
        return $content;
    }
337558
public function searchFromJson($json)
    {
        if (is_string($json)) {
            $json = yii\helpers\Json::decode($json);
        }
        if (isset($json['mainEntityClassName'], $json['searchQuery']) === false) {
            throw new \RuntimeException("mainEntityClassName and searchQuery needed to be in json for search");
        }
        $mainEntityClassName = $json['mainEntityClassName'];
        $q = new SearchQuery($mainEntityClassName, $this, $json['searchQuery']);
        $q->pagination($q->pagination);
        return $q;
    }
66723
public function decode($json)
    {
        $decoded = json_decode($json, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            return null;
        }

        return $decoded;
    }
267835
public function deserialize(string $json): WrapperInterface
    {
        try {
            /** @var WrapperInterface $wrapper */
            $wrapper = $this->jms()->deserialize(
                $json,
                $this->wrapperClass(),
                'json'
            );
        } catch (\Exception $e) {
            throw new \RuntimeException('Error while deserialize "' . $json . '"', 0, $e);
        }

        return $wrapper;
    }
336586
public function json(array $json = [], $assoc = false)
    {
        $this->options['json']       = $json;
        $this->options['json_assoc'] = $assoc;
        return $this;
    }
743438
public function dontSeeResponseContainsJson($json = [])
    {
        $jsonResponseArray = new JsonArray($this->connectionModule->_getResponseContent());
        $this->assertFalse(
            $jsonResponseArray->containsArray($json),
            "Response JSON contains provided JSON\n"
            . "- <info>" . var_export($json, true) . "</info>\n"
            . "+ " . var_export($jsonResponseArray->toArray(), true)
        );
    }
1278398
public static function fromJson(
        string $name,
        bool $endsWithSession,
        DateTimeImmutable $issuedAt,
        string $json
    ) : self {
        $cookie = new self($name, $endsWithSession, $issuedAt);
        $cookie->data = json_decode($json, true);

        if (! is_array($cookie->data)) {
            throw JsonException::fromJsonDecodeError(json_last_error_msg());
        }

        return $cookie;
    }
816173
public static function fromJson($json)
    {
        $object = json_decode($json);

        $sale = new Sale();
        $sale->populate($object);

        return $sale;
    }
932392
public function parseJson($json)
    {
        $this->id = $json['id'];
        $this->name = $json['name'];
        $this->links = $json['links'];

        if (isset($json['xmpp_jid'])) {
            $this->xmppJid = $json['xmpp_jid'];
            //Statistics need to be implemented
            $this->created = new \DateTime($json['created']);
            $this->archived = $json['is_archived'];
            $this->privacy = $json['privacy'];
            $this->guestAccessible = $json['is_guest_accessible'];
            $this->topic = $json['topic'];
            $this->participants = array();
            foreach ($json['participants'] as $participant) {
                $this->participants[] = new User($participant);
            }
            $this->owner = new User($json['owner']);
            $this->guestAccessUrl = $json['guest_access_url'];
        }
    }
588775
protected function createJsonDefinition($json)
    {
        $errors = $this->validator->validateJsonDefinition($json);
        if (!empty($errors)) {
            throw new ValidationException($errors);
        }

        $definition = $this->serializer->deserialize(
            $json,
            'Graviton\\GeneratorBundle\\Definition\\Schema\\Definition',
            'json'
        );

        return new JsonDefinition($definition);
    }
1094251
public function handleUpdatePosition(string $json): void
	{
		if ($this->request->isAjax()) {
			$data = Json::decode($json);
			$this->getStorage()->updatePosition($data);
		}
		throw new AbortException;
	}
429355
public static function get_Json( &$json )
    {
        if( $json instanceof Json ) {
            return $json;
        }
        return !is_null($json)
            ? new Json($json)
            : null
            ;
    }
1138661
public static function fromJson($json){
    if(is_string($json)){
      $json = json_decode($json);
    }

    if(!property_exists($json, 'error')){
      throw new BadResponseException('Required parameter "error" not found');
    }
    
    if(is_null($json->error)){
      $shortReport = ShortReport::fromJson($json);

      if(!property_exists($json, 'payload')){
        throw new BadResponseException('Required parameter "payload" not found');
      }
      if(!property_exists($json, 'group_code')){
        throw new BadResponseException('Required parameter "group_code" not found');
      }
      if(!property_exists($json, 'daemon_code')){
        throw new BadResponseException('Required parameter "daemon_code" not found');
      }
      if(!property_exists($json, 'device_code')){
        throw new BadResponseException('Required parameter "device_code" not found');
      }
      if(!property_exists($json, 'callback_url')){
        throw new BadResponseException('Required parameter "callback_url" not found');
      }

      $payload = Payload::fromJson($json->payload);
      return new self(
        $shortReport->getUuid(),
        $shortReport->getTimestamp(),
        $shortReport->getStatus(),
        $payload,
        $json->group_code,
        $json->daemon_code,
        $json->device_code,
        $json->callback_url
      );
    }
    else{
      if(!property_exists($json->error, 'code')){
        throw new BadResponseException('Required parameter "error.code" not found');
      }

      throw AbstractReport::errorToException((int) $json->error->code);
    }
  }