Creates an instance from json string
@param string $json The json string
@result JsonConvertible Returns the resulting object
192133
static function FromString($json)
    {
        $jsonObj = @\json_decode($json);
        if (!is_a($jsonObj, 'stdClass')) {
            return null; 
        }
        $result = new static();
        $class = new \ReflectionClass($result);
        $props = $class->getProperties(\ReflectionProperty::IS_PUBLIC & ~ \ReflectionProperty::IS_STATIC);
        foreach ($props as $prop) {
            $name = $prop->getName();
            if (isset($jsonObj->$name)) {
                $prop->setValue($result, $jsonObj->$name);
            }
        }
        return $result;
    }
27877
private function decodeJSON($json)
    {
        $query = json_decode($json);
        if (json_last_error()) {
            throw new \Exception('JSON parsing threw an error: '.json_last_error_msg());
        }
        if (!is_object($query)) {
            throw new \Exception('The query is not valid JSON');
        }

        return $query;
    }
1172160
public static function createFromString(string $json): self
    {
        $data = guzzle_json_decode($json, true);

        if (
            !isset($data['api']) ||
            !isset($data['request']) ||
            !isset($data['response']) ||
            !isset($data['duration']) ||
            !isset($data['exception'])
        ) {
            throw new \InvalidArgumentException(
                'String passed to Message::createFromString() is valid JSON but does not contain required fields.'
            );
        }

        return new self(
            $data['api'],
            $data['duration'],
            guzzle_parse_request($data['request']),
            $data['response'] ? guzzle_parse_response($data['response']) : null,
            $data['exception'] ? \unserialize($data['exception']) : null
        );
    }
430136
public static function fromString($json, $directory = ".") {
        $json = json_decode($json, true);
        if (is_null($json))
            throw new SettingsException("invalid json");
        return new static($json, $directory);
    }
646726
public static Credentials createFromJson( String json )
    {
        JSONObject jsonObj = ( JSONObject ) new JSONTokener( json ).nextValue();

        if ( jsonObj.has( PasswordCredentials.PASSWORD ) ) {
            // Password credentials
            return PasswordCredentials.fromJson( jsonObj );
        } else {
            // OAuth2 credentials
            return OAuth2Credentials.fromJson( jsonObj );
        }
    }
964132
public static function makeFromJson(JsonResponse $json)
    {
        $content = $json->getContent();

        // If the contents of the JsonResponse does not starts with /**/ (typical laravel jsonp response)
        // we assume that it is a valid json response that can be decoded, or we just use the raw jsonp
        // contents for building the response
        if (! Str::startsWith($json->getContent(), '/**/')) {
            $content = \json_decode($json->getContent(), true);
        }

        $new = static::create($content, $json->getStatusCode());

        $new->headers = $json->headers;

        return $new;
    }
764487
public static function createFromJson(string $json): self
    {
        $data = \json_decode($json, true);
        if (!\is_array($data)) {
            throw new InvalidArgumentException('Invalid argument.');
        }

        return self::createFromKeyData($data);
    }
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;
    }
214658
public static function make($json)
    {
        $schema = json_decode(
            $json,
            true
        );
        if (!$schema) {
            throw new SchemaException(
                __CLASS__,
                __METHOD__,
                "Error decoding json file while creating schema",
                500
            );
        }

        if (!array_key_exists(
            'properties',
            $schema
        )
        ) {
            throw new SchemaException(
                __CLASS__,
                __METHOD__,
                "'properties' field has not been found for defining schema entry",
                500
            );
        }


        $instance = new self(
            PropertyCotainer::make(
                $schema['properties']
            )
        );

        if (array_key_exists(
            'database',
            $schema
        )
        ) {
            $instance->setDatabaseContainer(
                DatabaseContainer::make(
                    $schema['database'],
                    $instance->getPropertyContainer()
                )
            );
        }

        if (array_key_exists(
            'meta',
            $schema
        )) {
            $instance->setMeta($schema['meta']);
        }

        return $instance;
    }
863330
public static function fromJson($json)
    {
        $responseData = json_decode($json, true);

        if ( ! $responseData)
            return new static(false, [ResponseV3::E_INVALID_JSON]);

        return static::fromArray($responseData);
    }
962800
public static function fromJson($json){
    if(is_string($json)){
      $json = json_decode($json);
    }

    if (!isset($json->error) || is_null($json->error) ) {
      return new self($json->uuid, new DateTime($json->timestamp), $json->status);
    } else {
      if(!property_exists($json->error, 'code')){
        throw new BadResponseException('Required parameter "error.code" not found');
    }
      throw AbstractReport::errorToException($json->error->code);
    }
  }
982490
protected static function _parse_json($json) {
    $rval = json_decode($json);
    $error = json_last_error();
    if($error === JSON_ERROR_NONE && $rval === null) {
      $error = JSON_ERROR_SYNTAX;
    }
    switch($error) {
    case JSON_ERROR_NONE:
      break;
    case JSON_ERROR_DEPTH:
      throw new JsonLdException(
        'Could not parse JSON; the maximum stack depth has been exceeded.',
        'jsonld.ParseError');
    case JSON_ERROR_STATE_MISMATCH:
      throw new JsonLdException(
        'Could not parse JSON; invalid or malformed JSON.',
        'jsonld.ParseError');
    case JSON_ERROR_CTRL_CHAR:
    case JSON_ERROR_SYNTAX:
      throw new JsonLdException(
        'Could not parse JSON; syntax error, malformed JSON.',
        'jsonld.ParseError');
    case JSON_ERROR_UTF8:
      throw new JsonLdException(
        'Could not parse JSON from URL; malformed UTF-8 characters.',
        'jsonld.ParseError');
    default:
      throw new JsonLdException(
        'Could not parse JSON from URL; unknown error.',
        'jsonld.ParseError');
    }
    return $rval;
  }
543162
public static function fromJson($json)
    {
        $data = json_decode($json);

        // Recreate the object.
        $object = new static($data->username, $data->password, $data->url);
        $object->authToken = Token::fromJson(json_encode($data->authToken));
        $object->accessToken = Token::fromJson(json_encode($data->accessToken));
        $object->refreshToken = Token::fromJson(json_encode($data->refreshToken));
        $object->settings = Settings::fromJson(json_encode($data->settings));

        return $object;
    }
852376
@SuppressWarnings("UnusedDeclaration")
  public static Bindings fromJson( String json )
  {
    try
    {
      return PARSER.get().parseJson( json );
    }
    catch( ScriptException e )
    {
      throw new RuntimeException( e );
    }
  }
435918
public static function create(array $json)
    {
        $getNearestZoneResponse = new GetNearestZoneResponse();
        $getNearestZoneResponse->setStatusCode($json['status_code']);
        $getNearestZoneResponse->setStatusMessage($json['status_message']);

        // If a 'response' is provided
        if (array_key_exists('response', $json) && isset($json['response'])) {
            $getNearestZoneResponseResponse = new GetNearestZoneResponseResponse();
            $getNearestZoneResponseResponse->setDistance($json['response']['distance']);
            $getNearestZoneResponseResponse->setLat($json['response']['lat']);
            $getNearestZoneResponseResponse->setLng($json['response']['lng']);
            $getNearestZoneResponseResponse->setName($json['response']['name']);
            $getNearestZoneResponseResponse->setRange($json['response']['range']);
            $getNearestZoneResponse->setResponse($getNearestZoneResponseResponse);
        }

        return $getNearestZoneResponse;
    }
1249048
public static function fromJson($json){
    if(is_string($json)){
      $json = json_decode($json);
    }
    
    if(!property_exists($json, 'total')){
      throw new BadResponseException('Required parameter "total" not found');
    }
    if(!property_exists($json, 'fns_site')){
      throw new BadResponseException('Required parameter "fns_site" not found');
    }
    if(!property_exists($json, 'fn_number')){
      throw new BadResponseException('Required parameter "fn_number" not found');
    }
    if(!property_exists($json, 'shift_number')){
      throw new BadResponseException('Required parameter "shift_number" not found');
    }
    if(!property_exists($json, 'receipt_datetime')){
      throw new BadResponseException('Required parameter "receipt_datetime" not found');
    }
    if(!property_exists($json, 'fiscal_receipt_number')){
      throw new BadResponseException('Required parameter "fiscal_receipt_number" not found');
    }
    if(!property_exists($json, 'fiscal_document_number')){
      throw new BadResponseException('Required parameter "fiscal_document_number" not found');
    }
    if(!property_exists($json, 'fiscal_document_attribute')){
      throw new BadResponseException('Required parameter "fiscal_document_attribute" not found');
    }
    if(!property_exists($json, 'ecr_registration_number')){
      throw new BadResponseException('Required parameter "ecr_registration_number" not found');
    }

    return new self(
      $json->total,
      $json->fns_site,
      $json->fn_number,
      $json->shift_number,
      new DateTime($json->receipt_datetime),
      $json->fiscal_receipt_number,
      $json->fiscal_document_number,
      $json->fiscal_document_attribute,
      $json->ecr_registration_number
    );
  }
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;
    }