import json


def json_or_str(arg, json_decoder=json.loads):
    """Parse inputs that can be either json or string as json if it looks like JSON otherwise string"""
    is_json = len(arg.split("{")) > 1 or len(arg.split("[")) > 1
    if is_json:
        return json_decoder(arg)
    return arg.split(" ")