import six
import json


def file_json(path):
    """ Returns formatted json from file

    :param path: path to file
    :type path: str
    :returns: formatted json as a string
    :rtype: bytes
    """
    with open(path) as f:
        return six.b(
            json.dumps(json.load(f),
                       sort_keys=True,
                       indent=2,
                       separators=(',', ': '))) + b'\n'