json_decode

Supported Versions: PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL json >= 1.2.0
Decodes a JSON string
<?php json_decode(    string $json,    ?bool $associative = null,    int $depth = 512,    int $flags = 0): mixed
<?php             return [];

        }



        return is_string($preferences) ? json_decode($preferences, true) : $preferences;

    }



    public function setPreferences($preferences)
<?php         }



        try {

            return collect(json_decode($this->files->get($composerPath), true)['autoload']['psr-4'])->flip()->get('src');

        } catch (Exception $exception) {

            return $default;

        }
<?php     protected function addRepositoryPath()

    {

        $decoded = json_decode($this->files->get(base_path('composer.json')), true);



        $decoded['repositories'][] = [

            'type' => 'path',
<?php {

    public static function isMissingPreUpdateCmd()

    {

        $composerJson = json_decode(File::get(base_path('composer.json')), true);



        $scripts = Arr::get($composerJson, 'scripts.pre-update-cmd', []);
<?php         ],\n

EOT;



        $preUpdateCmdsExist = Arr::get(json_decode($composerJson, true), 'scripts.pre-update-cmd', false);



        if ($preUpdateCmdsExist) {

            $composerJson = preg_replace('/("pre-update-cmd".*\n)/m', "$1            \"$preUpdateCmdScript\",\n", $composerJson);
<?php             $composerJson = preg_replace('/("scripts".*\n)/m', '$1'.$preUpdateCmdsArray, $composerJson);

        }



        $success = Arr::get(json_decode($composerJson, true), 'scripts.pre-update-cmd', false);



        if ($success === false) {

            throw new \Exception('Statamic had trouble adding the `pre-update-cmd` to your composer.json file.');
<?php     {

        $this->ensureExists();



        $lock = json_decode($this->files->get($this->path));



        $installed = collect($lock->packages)

            ->merge($lock->{'packages-dev'})
<?php     {

        $this->ensureExists();



        $lock = json_decode($this->files->get($this->path), true);



        return collect($lock['packages'] ?? [])

            ->merge($lock['packages-dev'] ?? [])
<?php     {

        $this->ensureExists();



        return collect(json_decode($this->files->get($this->path), true)['packages-dev'] ?? [])

            ->pluck('name')

            ->contains($package);

    }
<?php     public function overridePackageVersion($package, $version)

    {

        $content = json_decode($this->files->get($this->path), true);



        $packages = collect($content['packages'])

            ->map(function ($packageDetails) use ($package, $version) {
<?php         $json = substr($output, strpos($output, "\n{"));



        return json_decode($json);

    }
<?php             if ($value instanceof JsonSerializable) {

                return $value->jsonSerialize();

            } elseif ($value instanceof Jsonable) {

                return json_decode($value->toJson(), true);

            } elseif ($value instanceof Arrayable) {

                return $value->toArray();

            }
<?php         $packages = [];



        if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) {

            $installed = json_decode($this->files->get($path), true);

            $packages = $installed['packages'] ?? $installed;

        }
<?php         $autoload = $package['autoload']['psr-4'][$namespace.'\\'];

        $directory = Str::removeRight(dirname($reflector->getFileName()), rtrim($autoload, '/'));



        $json = json_decode(File::get($directory.'/composer.json'), true);

        $statamic = $json['extra']['statamic'] ?? [];

        $author = $json['authors'][0] ?? null;
<?php     public function process($value)

    {

        $value = json_decode($value, true);



        $structure = collect($value)->map(function ($row) {

            if ($row['type'] !== 'set') {