import json


def jsonString(obj, pretty=False):
    """Creates a json object, if pretty is specifed as True proper
    formatting is added
    Args as data:
        obj: object that needs to be converted to a json object
        pretty: Boolean specifying whether json object has to be formatted
    Returns:
        JSON object corresponding to the input object
       """
    if pretty == True:
        return json.dumps(obj, sort_keys=True, indent=4, separators=(',', ': ')) + '\n'
    else:
        return json.dumps(obj)