public static function format($json, array $arrayKeys = array(), $indent = self::DEFAULT_INDENT, $formatJson = true)
    {
        if ($formatJson) {
            $json = ComposerJsonFormatter::format($json, true, true);
        }

        if (4 !== $indent) {
            $json = str_replace('    ', sprintf('%'.$indent.'s', ''), $json);
        }

        return self::replaceArrayByMap($json, $arrayKeys);
    }
public static function format($json, array $arrayKeys = array(), $indent = self::DEFAULT_INDENT, $formatJson = true)
    {
        if ($formatJson) {
            $json = ComposerJsonFormatter::format($json, true, true);
        }

        if (4 !== $indent) {
            $json = str_replace('    ', sprintf('%'.$indent.'s', ''), $json);
        }

        return self::replaceArrayByMap($json, $arrayKeys);
    }
public static function format ( $ json , array $ arrayKeys = array ( ) , $ indent = self :: DEFAULT_INDENT , $ formatJson = true ) { if ( $ formatJson ) { $ json = ComposerJsonFormatter :: format ( $ json , true , true ) ; } if ( 4 !== $ indent ) { $ json = str_replace ( '    ' , sprintf ( '%' . $ indent . 's' , '' ) , $ json ) ; } return self :: replaceArrayByMap ( $ json , $ arrayKeys ) ; }
Format the data in JSON.

@param string   $json       The original JSON
@param string[] $arrayKeys  The list of keys to be retained with an array representation if they are empty
@param int      $indent     The space count for indent
@param bool     $formatJson Check if the json must be formatted

@return string
Format the data in JSON .