public static function invoke($jsonString, $returnNode = false)
    {
        $dom = new \DOMDocument('1.0', 'UTF-8');

        $jsonString = mb_convert_encoding($jsonString, 'UTF-8', mb_detect_encoding($jsonString));

        $jsonDecode = json_decode($jsonString, false);
        $lastError = json_last_error();

        if (JSON_ERROR_NONE === $lastError)
        {
            $ul = $dom->createElement('ul');
            $ul->setAttribute('class', 'json-list');
            $dom->appendChild($ul);

            if ($jsonDecode instanceof \stdClass)
                self::objectOutput($jsonDecode, $dom, $ul);
            else if (is_array($jsonDecode))
                self::arrayOutput($jsonDecode, $dom, $ul);

            if ($returnNode)
                return $dom;

            return static::saveHTMLExact($dom, $ul);
        }

        throw new \DomainException(sprintf(
            'Could not convert input to HTML: "%s"',
            JsonErrorHelper::invoke(true, $lastError)
        ));
    }
public static function invoke($jsonString, $returnNode = false)
    {
        $dom = new \DOMDocument('1.0', 'UTF-8');

        $jsonString = mb_convert_encoding($jsonString, 'UTF-8', mb_detect_encoding($jsonString));

        $jsonDecode = json_decode($jsonString, false);
        $lastError = json_last_error();

        if (JSON_ERROR_NONE === $lastError)
        {
            $ul = $dom->createElement('ul');
            $ul->setAttribute('class', 'json-list');
            $dom->appendChild($ul);

            if ($jsonDecode instanceof \stdClass)
                self::objectOutput($jsonDecode, $dom, $ul);
            else if (is_array($jsonDecode))
                self::arrayOutput($jsonDecode, $dom, $ul);

            if ($returnNode)
                return $dom;

            return static::saveHTMLExact($dom, $ul);
        }

        throw new \DomainException(sprintf(
            'Could not convert input to HTML: "%s"',
            JsonErrorHelper::invoke(true, $lastError)
        ));
    }
public static function invoke ( $ jsonString , $ returnNode = false ) { $ dom = new \ DOMDocument ( '1.0' , 'UTF-8' ) ; $ jsonString = mb_convert_encoding ( $ jsonString , 'UTF-8' , mb_detect_encoding ( $ jsonString ) ) ; $ jsonDecode = json_decode ( $ jsonString , false ) ; $ lastError = json_last_error ( ) ; if ( JSON_ERROR_NONE === $ lastError ) { $ ul = $ dom -> createElement ( 'ul' ) ; $ ul -> setAttribute ( 'class' , 'json-list' ) ; $ dom -> appendChild ( $ ul ) ; if ( $ jsonDecode instanceof \ stdClass ) self :: objectOutput ( $ jsonDecode , $ dom , $ ul ) ; else if ( is_array ( $ jsonDecode ) ) self :: arrayOutput ( $ jsonDecode , $ dom , $ ul ) ; if ( $ returnNode ) return $ dom ; return static :: saveHTMLExact ( $ dom , $ ul ) ; } throw new \ DomainException ( sprintf ( 'Could not convert input to HTML: "%s"' , JsonErrorHelper :: invoke ( true , $ lastError ) ) ) ; }
Invoke the helper

@param $jsonString
@param bool $returnNode
@return \DOMNode|string
Invoke the helper