Welcome to EverybodyWiki 😃 ! Nuvola apps kgpg.png Log in or ➕👤 create an account to improve, watchlist or create an article like a 🏭 company page or a 👨👩 bio (yours ?)...

PHP JSON Parser

From EverybodyWiki Bios & Wiki


JPOPHP, Json Parser Object PHP
Original author(s)Max Base
Developer(s)Max Base
Initial release2018
Stable release
2.2.1 / Apr 2019
Engine
    Operating systemCross-platform
    TypePHP Library
    LicenseGNU General Public License v3.0
    WebsitePHP JsonParser at Github

    Amazon.com Logo.png Search PHP JSON Parser on Amazon.

    JPOPHP (Json Parser Object PHP) is a library for parsing data in JSON format. JPOPHP is used primarily to encode and decode JSON data. This library is licensed under the GNU General Public License v3.0[1] and is open-source.[2][3][4]

    PHP JSON Parser is published in the Official PHP Classes Repository. [5] JsonParserObjectPHP was a reason the Max a first rank in the US and ranked fourth in the world at the 2019/02.[6]

    Type of supported values[edit]

    • Integer
    • Float
    • Boolean (true , false)
    • Null
    • String
    • Char
    • Sub Array
    • Sub Object

    Functionalities[edit]

    • Supports JSON Grammar.
    • Support all data types.
    • Encode and Decode the JSON data.
    • Support Unicode.

    Awards[edit]

    • PHP Programming Innovation award nominee, January 2019. [5]
    • PHP Programming Innovation award winner, February 2019. [7]

    History[edit]

    • In 2018, Max Base began designing this library.
    • In 2019/01, This package is published in the Official PHP Classes Repository.[8]
    • In 2019/01/25, This package has also been downloaded and used up to 9,384.[6]
    • In 2019/02/27, Rank first in the US (This week).
    • In 2019/02/27, Receive the Innovation Award By PHP Classes.
    • In 2019/03/05, Rank first in the Canada (This week).[9]
    • In 2019/03/25, Rank first in the Canada (This week).
    • In 2019/03/31, This package has publish in the Composer.[2]
    • In 2019/04/02. In the recent 2019 competition, this library was chosen as one of the best. (Third place) and now (2019/04/04) are rank 2nd classes in the world.
    • In 2019/04/03, First rank in the User Ratings in month. (2019-04)
    • In 2019/04/04, In the current week, Max Basewas introduced as the second most popular programmer. [10]
    • In 2019/04/04, First rank in the Top user rated classes, 65% of all comments from forum users were assigned to this library. [10]

    Functions[edit]

    [11]

    Function Name Goal Parameter(s) Return
    encode Encode the data in JSON format. $input (Array or Object) String
    decode Decode the data in JSON format. $input (JSON string) Array

    Initial[edit]

    E.g.: We define the class in $json variable.

    $json=new Json;
    

    Encode[edit]

    $array = array(null, false, true);
    $result = $json->encode($array);
    print( $result );
    

    Decode[edit]

    $string = '[null,false,true]';
    $result = $json->decode($string);
    print_r( $result );
    

    Example[edit]

    [11]

     1<?php
     2include "JPOPHP.php";
     3/* Version: 2.2+ */
     4print $json->encode([1,2,3,4])."\n";
     5print $json->encode([1,2,[94,15,34,67],3,4,["name"=>"max"]])."\n";
     6print $json->encode(["name"=>"max","age"=>49,"username"=>"BaseMax"])."\n";
     7print $json->encode(["0"=>"max","1"=>49,"2"=>"BaseMax"])."\n";
     8print $json->encode([0=>"max",1=>49,2=>"BaseMax"])."\n";
     9print $json->encode([0=>"max","1.5"=>49,2=>"BaseMax"])."\n";
    10print "\n\n";
    11print $json->decode('[]')."\n";
    12print $json->decode('{}')."\n";
    13print $json->decode('["1"]')."\n";
    14print $json->decode('["123456"]')."\n";
    15print $json->decode('["hi"]')."\n";
    16print $json->decode('["hi\""]')."\n";
    17print $json->decode('["hi\"!"]')."\n";
    18print $json->decode('[13]')."\n";
    19print $json->decode('[134]')."\n";
    20print $json->decode('[8]')."\n";
    21print $json->decode('[0]')."\n";
    22print $json->decode('[-9]')."\n";
    23print $json->decode('[-945]')."\n";
    24print $json->decode('[3.1]')."\n";
    25print $json->decode('[3.145]')."\n";
    26print_r($json->decode('			  [  -3.145,4,"test"]'));
    27print_r($json->decode('			  [  -3.145,4,"test","name":"max"]'));
    28print_r($json->decode('			  [  -3.145,4,"name","max",]'));
    29print_r($json->decode('			  [  -3.145,4,"name","max",,,,,,,]'));
    30print_r($json->decode('			  [,]'));
    31print_r($json->decode('			  [,,,,]'));
    32print_r($json->decode('			  [,,,,4]'));
    33print_r($json->decode('{}'));
    34print_r($json->decode('{"a":4,"6":945,,,}'));
    35print_r($json->decode('{"a":4,"b":456,,,,}'));
    36print_r($json->decode('{,"a":4,}'));
    37print_r($json->decode('{,,,"a":4,"b":456,,,,}'));
    38print_r($json->decode('{,,,,"a":4,,,,,,"6":945,,,}'));
    39print_r($json->decode('[,,,,]'));
    40print_r($json->decode('[4]'));
    41print_r($json->decode(' [,,,,4]'));
    42print_r($json->decode(' [  , , , , 4]'));
    43print_r($json->decode(' [  , , , , 4 ]    '));
    44print_r($json->decode(' [  , , 	,	 , 	4	 ]    '));
    45print_r($json->decode("[\n]"));
    46print_r($json->decode('["max",49,"BaseMax"]'));
    47print_r($json->decode('[1,[]]'));
    48print_r($json->decode('[1,[4]]'));
    49print_r($json->decode('[1,[4,,,6,[8]]]'));
    50print_r($json->decode('{"name":"Max","line":456,,,,}'));
    51print_r($json->decode('{"name":"Max","line":456,,,,}'));
    52// print_r($json->decode('{"name":"Max",4:555,,,,}')); // Error!
    53print_r($json->decode('[null,false,true]'));
    54$res=($json->decode('[null,false,true]'));
    55var_dump($res[1]);
    56var_dump($res);
    57var_dump($json->decode('[null,false,true,]'));
    58print_r($json->decode("[\"45\\\\\"]"));
    59$arg='["4\\\\"]';
    60var_dump($arg);
    61print $arg."\n";
    62print_r($json->decode($arg));
    63print_r($json->decode('["1\u05B5"]'));
    64print_r($json->decode('["1\u05F1"]'));
    65print_r($json->decode('["1\u05F"]'));
    66print_r($json->decode('["1\u05FX"]'));
    67print_r($json->decode('["1\uM05F"]'));
    68print_r($json->decode('["1\uM0\'5F"]'));
    69
    70/* Version: 0 - 2.0
    71$data=json_encode([1,2,3,4,5,"n\"am':=>[]{}e"=>"ali"]);
    72$data=json_encode(["name"=>"ali","int"=>110,"float"=>19.98,"-int"=>-110,"-float"=>-19.98,"bool"=>true]);
    73//$data=json_encode(["name"=>"ali","int"=>110,"float"=>19.98,"-int"=>-110,"-float"=>-19.98,"bool"=>true,"list"=>[1,2,3,4,5]]);
    74//$data=json_encode(["name"=>"ali","int"=>110,"float"=>19.98,"-int"=>-110,"-float"=>-19.98,"bool"=>true,"list"=>["name"=>"ali","family"=>"ahmadi"]]);
    75//print $data."\n";
    76//$array=$json->decode($data);
    77//$array=$json->decode('{"list":{"name":"ali","family":"ahmadi"}}');
    78$array=$json->decode('{"list":{"name":"ali","family":"ahmadi"},"age":18}');
    79//$array=$json->decode('{"name":"ali","int":110,"float":19.98,"-int":-110,"-float":-19.98,"bool":TRUE,"bbb":false}');
    80print_r($array);
    81//print_r($json->array);
    82*/
    

    References[edit]

    1. "GNU General Public License v3.0".
    2. 2.0 2.1 "basemax/jsonparser - Packagist". packagist.org. Retrieved 2019-03-31.
    3. "Notable PHP package: PHP JSON Parser Class - PHP Classes". www.phpclasses.org. Retrieved 2019-06-10.
    4. "basemax/jpophp-jsonparser - Packagist". packagist.org. Retrieved 2019-06-11.
    5. 5.0 5.1 "PHP JSON Parser Class: Encode and decode data in JSON format - PHP Classes". www.phpclasses.org. Retrieved 2019-03-31.
    6. 6.0 6.1 "LMPHP: Support to multiple languages to PHP applications - PHP Classes". web.archive.org. 2019-01-25. Retrieved 2019-01-25.
    7. "Innovation Award winners - PHP Classes". www.phpclasses.org. Retrieved 2019-06-11.
    8. "PHP JSON Parser Class: Encode and decode data in JSON format - PHP Classes". www.phpclasses.org. Retrieved 2019-01-25.
    9. "Classes of Max Base - PHP Classes". phpclasses.org. 2019-03-05. Retrieved 2019-03-05.
    10. 10.0 10.1 "Top 10 charts - PHP Classes". web.archive.org. 2019-04-03. Retrieved 2019-04-04.
    11. 11.0 11.1 Base, Max (2019-03-31), Tiny Library for parse JSON. Contribute to BaseMax/JsonParser development by creating an account on GitHub, retrieved 2019-03-31


    This article "PHP JSON Parser" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:PHP JSON Parser. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.