json_encode

Supported Versions: PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL json >= 1.2.0
Returns the JSON representation of a value
<?php json_encode(mixed $value, int $flags = 0, int $depth = 512): string|false
<?php             'url' => "addons/{$this->vendorSlug}/{$this->nameSlug}",

        ];



        $json = json_encode($decoded, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);



        $this->files->put(base_path('composer.json'), $json);
<?php         $content['packages'] = $packages;



        $this->files->put($this->path, json_encode($content, JSON_UNESCAPED_SLASHES));



        return $this;

    }
<?php         return $this

            ->fluentlyGetOrSet('taxonomies')

            ->getter(function ($taxonomies) {

                $key = "collection-{$this->id()}-taxonomies-".md5(json_encode($taxonomies));



                return Blink::once($key, function () use ($taxonomies) {

                    return collect($taxonomies)->map(function ($taxonomy) {
<?php         if ($response instanceof JsonResponse) {

            $original = $response->getOriginalContent();

            $original['message'] = __($original['message']);

            $response->setContent(json_encode($original));

        }



        return $response;
<?php     private function getImportedFields(array $config): array

    {

        $blink = 'blueprint-imported-fields-'.md5(json_encode($config));



        return Blink::once($blink, function () use ($config) {

            if (! $fieldset = FieldsetRepository::find($config['import'])) {
<?php     {

        $submissions = $this->form()->submissions()->toArray();



        return json_encode($submissions);

    }
<?php         $query = $request->input('query');

        $vars = $request->input('variables');



        return 'gql-cache:'.md5($query).'_'.md5(json_encode($vars));

    }



    public function handleInvalidationEvent(Event $event)
<?php     {

        $permissions = $user ? $user->permissions() : [];



        return base64_encode(json_encode($permissions));

    }



    protected function user($user)
<?php     {

        $endpoint = collect([$this->domain, self::API_PREFIX, $endpoint])->implode('/');



        $key = 'marketplace-'.md5($endpoint.json_encode($params));



        return Cache::rememberWithExpiration($key, function () use ($endpoint, $params) {

            $response = Guzzle::request('GET', $endpoint, [
<?php     {

        return '<script>

            window.log=function(a){if(this.console){console.log(a);}};

            log('.json_encode($value).');

        </script>';

    }
<?php             $value = $value->toAugmentedArray();

        }



        return json_encode($value, $options);

    }
<?php         $pattern = '/^'.str_replace(['%', '_'], ['.*', '.'], preg_quote($like, '/')).'$/im';



        if (is_array($item)) {

            $item = json_encode($item);

        }



        return preg_match($pattern, $item);
<?php         $this->files->put(

            "{$this->exportPath}/composer.json",

            json_encode($composerJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)."\n"

        );



        return $this;
<?php         $this->files->put(

            base_path('composer.json'),

            json_encode($composerJson, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)

        );



        Blink::put('starter-kit-repository-added', $this->url);
<?php         $this->files->put(

            base_path('composer.json'),

            json_encode($composerJson, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)

        );



        return $this;