\Seld\JsonLintJsonParser

Parser class

Example:

$parser = new JsonParser(); // returns null if it's valid json, or an error object $parser->lint($json); // returns parsed json, like json_decode does, but slower, throws exceptions on failure. $parser->parse($json);

Ported from https://github.com/zaach/jsonlint

Summary

Methods
Properties
Constants
lint()
parse()
No public properties found
DETECT_KEY_CONFLICTS
ALLOW_DUPLICATE_KEYS
PARSE_TO_ASSOC
parseError()
No protected properties found
N/A
performAction()
stringInterpolation()
popStack()
lex()
failOnBOM()
$lexer
$flags
$stack
$vstack
$lstack
$symbols
$terminals_
$productions_
$table
$defaultActions
N/A

Constants

DETECT_KEY_CONFLICTS

DETECT_KEY_CONFLICTS = 1

ALLOW_DUPLICATE_KEYS

ALLOW_DUPLICATE_KEYS = 2

PARSE_TO_ASSOC

PARSE_TO_ASSOC = 4

Properties

$lexer

$lexer : 

Type

$flags

$flags : 

Type

$stack

$stack : 

Type

$vstack

$vstack : 

Type

$lstack

$lstack : 

Type

$symbols

$symbols : 

Type

$terminals_

$terminals_ : 

Type

$productions_

$productions_ : 

Type

$table

$table : 

Type

$defaultActions

$defaultActions : 

Type

Methods

lint()

lint(string  $input, integer  $flags) : null|\Seld\JsonLint\ParsingException

Parameters

string $input

JSON string

integer $flags

Bitmask of parse/lint options (see constants of this class)

Returns

null|\Seld\JsonLint\ParsingException

null if no error is found, a ParsingException containing all details otherwise

parse()

parse(string  $input, integer  $flags) : mixed

Parameters

string $input

JSON string

integer $flags

Bitmask of parse/lint options (see constants of this class)

Throws

\Seld\JsonLint\ParsingException

Returns

mixed

parseError()

parseError(  $str,   $hash) 

Parameters

$str
$hash

performAction()

performAction(\stdClass  $yyval,   $yytext,   $yyleng,   $yylineno,   $yystate,   $tokens) 

Parameters

\stdClass $yyval
$yytext
$yyleng
$yylineno
$yystate
$tokens

stringInterpolation()

stringInterpolation(  $match) 

Parameters

$match

popStack()

popStack(  $n) 

Parameters

$n

lex()

lex() 

failOnBOM()

failOnBOM(  $input) 

Parameters

$input