Json decode.
@param  any        $data
@param  array|null $options
@return array
489054
public static final function jsonDecode($data, array $options = null): array
    {
        $encoder = new JsonEncoder($options);

        return [$encoder->decode($data), $encoder->hasError()
            ? new EncoderException('JSON Error: '. $encoder->getError()) : null];
    }
777918
private function dataToJson($data)
        {
            $cols = $this->getColumns($data);

            $rows = [];

            foreach ($data as $key => $row) {
                if ($key != 0 || !$this->_skipFirstRow) {
                    $c = [];

                    foreach ($row as $v) {
                        $c[] = ['v' => $v];
                    }

                    $rows[] = ['c' => $c];
                }
            }

            return json_encode(['cols' => $cols, 'rows' => $rows]);
        }
546833
public static function decode(string $json, int $options = 0)
	{
		if (!\preg_match('##u', $json)) {
			throw new JsonException('Invalid UTF-8 sequence', 5); // workaround for PHP < 5.3.3 & PECL JSON-C
		}

		$forceArray = (bool) ($options & self::FORCE_ARRAY);

		if (!$forceArray && \preg_match('#(?<=[^\\\\]")\\\\u0000(?:[^"\\\\]|\\\\.)*+"\s*+:#', $json)) { // workaround for json_decode fatal error when object key starts with \u0000

			throw new JsonException(static::$messages[\JSON_ERROR_CTRL_CHAR]);
		}

		$args = [$json, $forceArray, 512];

		if (\PHP_VERSION_ID >= 50400 && !(\defined('JSON_C_VERSION') && \PHP_INT_SIZE > 4)) { // not implemented in PECL JSON-C 1.3.2 for 64bit systems
			$args[] = \JSON_BIGINT_AS_STRING;
		}

		$value = \json_decode(...$args);

		if ($value === null && $json !== '' && \strcasecmp($json, 'null')) { // '' is not clearing json_last_error
			$error = \json_last_error();

			throw new JsonException(static::$messages[$error] ?? 'Unknown error', $error);
		}

		return $value;
	}
1130643
public static function stringToStruct($data, array $options = [])
    {
        $assoc = StructureHelper::getValue($options, 'assoc', false);
        $depth = StructureHelper::getValue($options, 'depth', 512);
        $option = StructureHelper::getValue($options, 'options', 0);

        return json_decode(trim($data), $assoc, $depth, $option);
    }
748867
public static function Decrypt ($data, $key, $options = []) {
		$options = static::_AdjustOptions($options);
		return openssl_decrypt($data, $options['method'], $key, $options['openssl_options'], $options['iv']);
	}
297569
public function getArray(array $options = array()): array
    {
        $content = $this->getContent();

        if (is_null($content)) {
            return (array)$content;
        }

        return json_decode($this->content, true);
    }
1146618
public static function toJson($resource, $options = 0) {
        if ($resource instanceof JsonSerializable) {
            // pass-through

        } else if ($resource instanceof Jsonable) {
            return $resource->toJson($options);

        } else if (static::isJson($resource)) {
            return $resource;

        } else if (static::isObject($resource)) {
            $resource = static::buildArray($resource);

        } else if (static::isXml($resource)) {
            $resource = static::xmlToArray(simplexml_load_string($resource));

        } else if (static::isSerialized($resource)) {
            $resource = unserialize($resource);
        }

        return json_encode($resource, $options);
    }
1139368
public function  convert($data=false,$options= false){
		if (!$data) {
			return $data;
		};
		if (!isset($data[0])) {
			$data = array($data);
		}
					
		
		
		 		
		$this->scan($data);

	}
1113258
public function body($data = null, $options = []) {
		$default = ['buffer' => null];
		$options += $default;
		$this->body = array_merge((array) $this->body, (array) $data);
		$body = join("\r\n", $this->body);
		return ($options['buffer']) ? str_split($body, $options['buffer']) : $body;
	}
655845
public function decode(string $data): array
    {
        $decoded = $json = json_decode($data, true);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw DeserializerRuntimeException::createNotParsable($this->getContentType(), json_last_error_msg());
        }

        if (!is_array($decoded)) {
            throw DeserializerRuntimeException::createNotParsable($this->getContentType(), 'Not an object');
        }

        return $decoded;
    }
238335
public function deserialize($data, $object, array $options = [])
    {
        $properties = $this->getSerializableProperties($object, [self::INCLUDE_MANY_TO_ONE]);
        //update the mapObjectToEntity method instead of doing this
        $data = json_decode(json_encode($data));

        return $this->mapObjectToEntity(
            $properties,
            $this->resolveData($properties, $data, get_class($object)),
            $object
        );
    }
699284
private function _toJson($data)
    {
        if ($data) {
            if (is_array($data)) {
                return json_encode($this->_toCleanArray($data));
            }

            return json_encode($data);
        }
    }
1169267
protected function encode($data, $options = 0)
    {
        // Check is already json string.
        if (is_string($data) && strlen($data) >= 1) {
            $firstChar = $data[0];

            if (in_array($firstChar, ['[', '{', '"'])) {
                return $data;
            }
        }

        // Clear json_last_error()
        json_encode(null);

        $json = json_encode($data, $options);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \UnexpectedValueException(sprintf('JSON encode failure: %s', json_last_error_msg()));
        }

        return $json;
    }
1367151
public function decode(array $options = [])
    {
        $json = json_decode($this->getContents(), true);

        if ($json === null && json_last_error() === JSON_ERROR_NONE) {
            $this->validateSyntax();

            return $this;
        }

        $this->validateSchema();

        return $json;
    }
1153369
private function deserialize($data)
    {
        $result = json_decode(base64_decode($data, true), true);

        return is_array($result) ? $result : [];
    }
781873
protected function json_encode_options($options)
    {
        $data = $this->prepare_options($options);

        $json = json_encode($data['options']);

        $json = str_replace($data['toReplace'], $data['original'], $json);

        return $json;
    }
234758
public function deserialize($data, $content = null, array $options = [])
    {
        if ('text/html' === $data['type'] || 'text/plain' === $data['type']) {
            // HTML is directly stored in the choice entity
            $content->setData($data['data']);
            $content->setResourceNode(null);
        } else {
            // Other types require a ResourceNode
            $node = $this->resourceContentSerializer->deserialize($content);

            $content->setData('');
            $content->setResourceNode($node);
        }

        return $content;
    }