Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. JsonFile.php

function JsonFile::parseJson

Parses json string and returns hash.

Parameters

null|string $json json string:

string $file the json file:

Return value

mixed

Throws

ParsingException

23 calls to JsonFile::parseJson()
ArtifactRepository::getComposerInformation in vendor/composer/composer/src/Composer/Repository/ArtifactRepository.php
ComposerRepository::fetchFile in vendor/composer/composer/src/Composer/Repository/ComposerRepository.php
ConfigCommand::execute in vendor/composer/composer/src/Composer/Command/ConfigCommand.php
ConfigReturnTypeExtension::__construct in vendor/composer/composer/src/Composer/PHPStan/ConfigReturnTypeExtension.php
GitBitbucketDriver::getComposerInformation in vendor/composer/composer/src/Composer/Repository/Vcs/GitBitbucketDriver.php
@inheritDoc

... See full list

File

vendor/composer/composer/src/Composer/Json/JsonFile.php, line 340

Class

JsonFile
Reads/writes json files.

Namespace

Composer\Json

Code

public static function parseJson(?string $json, ?string $file = null) {
    if (null === $json) {
        return null;
    }
    $data = json_decode($json, true);
    if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
        self::validateSyntax($json, $file);
    }
    return $data;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal