class Json

php json 함수 사용시 exception 이 발생하지 않기 때문에 예외처리가 가능하도록 exception 을 발생

Methods

static string
encode(mixed $value, int $options, int $depth = 512)

call json_encode function

static mixed
decode(string $string, bool $assoc = false, int $depth = 512, int $options)

call json_decode function

static string
format(string $json, bool $unescapeUnicode, bool $unescapeSlashes)

주어진 json string을 보기 편하게 정리한다.

static void
lastError()

catch last error and throw exception

static void
exception(int $error)

message make for version lower then 5.5.0

Details

at line 39
static string encode(mixed $value, int $options, int $depth = 512)

call json_encode function

Parameters

mixed $value target for encoding
int $options json behavior constant
int $depth maximum depth

Return Value

string

at line 58
static mixed decode(string $string, bool $assoc = false, int $depth = 512, int $options)

call json_decode function

Parameters

string $string target for decoding
bool $assoc when true, object be converted to array
int $depth recursion depth
int $options decode option, just support 'JSON_BIGINT_AS_STRING'

Return Value

mixed

at line 81
static string format(string $json, bool $unescapeUnicode, bool $unescapeSlashes)

주어진 json string을 보기 편하게 정리한다.

This code is based on the Composer\Json\JsonFormatter::format(): https://github.com/composer/composer/blob/master/src/Composer/Json/JsonFormatter.php

Originally licensed under MIT by Dave Perrett mail@recursive-design.com

Parameters

string $json json string
bool $unescapeUnicode Un escape unicode
bool $unescapeSlashes Un escape slashes

Return Value

string

at line 180
static protected void lastError()

catch last error and throw exception

Return Value

void

at line 199
static protected void exception(int $error)

message make for version lower then 5.5.0

Parameters

int $error constant of error type

Return Value

void