Morph the given content into JSON.

@param  mixed $content The mixed content.
@return string
969961
protected function prepare_json_content( $content ) {
		if ( $content instanceof Jsonable ) {
			return $content->toJson();
		}

		if ( $content instanceof Arrayable ) {
			return json_encode( $content->toArray() );
		}

		return json_encode( $content );
	}
1097514
public function reverseTransform($content)
    {
        if (null === $content) {
            return null;
        }

        if (!is_string($content)) {
            throw new TransformationFailedException(sprintf(
                'Expected string, %s given',
                gettype($content)
            ));
        }

        //replace span with comment tag, so no weird style is added on front-end
        $content = StripTagsUtil::replaceSpanWith($content, StripTagsUtil::COMMENT_REPLACEMENT);

        return $content;
    }
1361167
protected function decodeContent(string $content): array
    {
        $result = json_decode($content, true);
        return is_array($result) ? $result : [];
    }
367077
public function decode_content($content) {
        if (!$content = $this->precheck_content($content)) { // Perform some prechecks
            return false;
        }
        // Iterate over all rules, chaining results
        foreach ($this->rules as $rule) {
            $content = $rule->decode($content);
        }
        return $content;
    }
566045
public function formatArray($content)
    {
        $content = $this->morphToArray($content);

        \array_walk_recursive($content, function (&$value) {
            $value = $this->morphToArray($value);
        });

        return $this->encode($content);
    }
463397
protected function setJsonContents(array $content)
	{
		$content = json_encode($content, JSON_PRETTY_PRINT);


		return $this->files->put($this->getJsonPath(), $content);
	}
638718
protected function should_be_json( $content ) {
		return $content instanceof Jsonable ||
			   $content instanceof Arrayable ||
			   $content instanceof ArrayObject ||
			   $content instanceof JsonSerializable ||
			   is_array( $content );
	}
860397
protected function reviseStyle( $content )
	{
		if( $this->protocol == self::PROTOCOL_HTTP )
		{
			$content	= str_ireplace( "https://", "http://", $content );
		}
		else if( $this->protocol == self::PROTOCOL_HTTPS )
		{
			$content	= str_ireplace( "http://", "https://", $content );
		}
		return $content;
	}
931948
public function contentParser($content)
    {
        return str_replace(['{{dataApiUrl}}', '{{title}}', '{{template}}'], [$this->getDataApiUrl(), $this->getTitle(), $this->_template], $content);
    }
1262175
public function parse(&$content)
	{
	    $str = $this->getEngineInstance()->parse($content);
	    return $this->getBeginContent() . $str;
	}
1252468
public function setContent( $content ) {
		$this->original = $content;

		if ( $this->should_be_json( $content ) ) {
			$this->header( 'Content-Type', 'application/json' );

			$content = $this->prepare_json_content( $content );
		}

		parent::setContent( $content );

		return $this;
	}
278295
public function parseContent($content) {
        $dc = json_decode($content, true);

        $ret = [];

        foreach ($dc as $key => $content) {
            preg_match("/^(?P<type>[a-z0-9A-Z]*):(?P<path>(?P<id>[a-z0-9A-Z]*):(?P<field>[a-z0-9A-Z]*))$/", $key, $matches);

            $ret[] = [
                'type' => $matches['type'],
                'path' => $matches['path'],
                'id' => $matches['id'],
                'field' => $matches['field'],
                'content' => $content
            ];
        }

        return $ret;
    }
207732
protected function shouldBeJson($content)
    {
        return $content instanceof Arrayable ||
               $content instanceof Jsonable ||
               $content instanceof ArrayObject ||
               $content instanceof JsonSerializable ||
               is_array($content);
    }
626193
public function prepareContent($content)
    {
        if (is_array($content)) {
            $ctt = '';
            foreach ($content as $key=>$ctt) {
                $content .= $ctt;
            }
            $content = $ctt;
        }
        $_escaped_output = strip_tags((string) $content);
        if ($_escaped_output != (string) $content) {
            if (preg_match('/(.*)<body(.*)</body>/i', (string) $content, $matches)) {
                $_output = $matches[0];
            } else {
                $_output = (string) $content;
            }
            $content = Html2Text::convert($_output);
        }
        return (string) $content;
    }
1324281
public static function encode($content, int $options = 0, int $depth = 512): string
    {
        $json = json_encode($content, $options, $depth);

        self::throwOnError();

        return $json;
    }
621900
public function replace($content)
    {
        foreach ($this->hasChild as $name => $value) {
            $name = $this->placeholder($name);
            $this->blocks[$name] = $this->_replace($this->blocks[$name]);
        }

        return $this->_replace($content);
    }
537138
public function setContent($content)
    {
        $this->original = $content;

        // If the content is "JSONable" we will set the appropriate header and convert
        // the content to JSON. This is useful when returning something like models
        // from routes that will be automatically transformed to their JSON form.
        if ($this->shouldBeJson($content)) {
            $this->header('Content-Type', 'application/json');

            $content = $this->morphToJson($content);
        }

        // If this content implements the "Renderable" interface then we will call the
        // render method on the object so we will avoid any "__toString" exceptions
        // that might be thrown and have their errors obscured by PHP's handling.
        elseif ($content instanceof Renderable) {
            $content = $content->render();
        }

        parent::setContent($content);

        return $this;
    }