class JsonFormatter (View source)

Formats json strings used for php < 5.4 because the json_encode doesn't supports the flags JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE in these versions

Methods

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

This code is based on the function found at: http://recursive-design.com/blog/2008/03/11/format-json-with-php/

Details

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

This code is based on the function found at: http://recursive-design.com/blog/2008/03/11/format-json-with-php/

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

Parameters

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

Return Value

string