Skip to content

R0bur/PHP-JSON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP-JSON

PHP-module for parsing JSON Author: Ihar Areshchankau, 2017-2019.

Mailto: r0bur@tut.by

One pretty simple but useful function for parsing JSON in PHP:

Usage:

...
require 'iaparser.php';
require 'iajson.php';
...
$array = iaJsonDecode ($json);
...

Example.

Source JSON:

{
	field1: 1234.5678,
	field2: "String value",
	field3: [1, 2, 3, 4],
	field4: {a: 1, b: 2, c: 3, d: 4},
	field5: "<img src=\"photo.jpg\">",
	field6: '\'Escaped single quotes\''
}

Resulting PHP array:

Array
(
    [field1] => 1234.5678
    [field2] => String value
    [field3] => Array
        (
            [0] => 1
            [1] => 2
            [2] => 3
            [3] => 4
        )

    [field4] => Array
        (
            [a] => 1
            [b] => 2
            [c] => 3
            [d] => 4
        )

    [field5] => <img src="photo.jpg">
    [field6] => 'Escaped single quotes'
)

Please look at 'demo.php' and 'demo.json' for reference.

About

PHP-module for parsing JSON

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages