def flatten_json(b, delim):
    """
    A simple function for flattening JSON by concatenating keys w/ a delimiter.
    """
    val = {}
    for i in b.keys():
        if isinstance(b[i], dict):
            get = flatten_json(b[i], delim)
            for j in get.keys():
                val[i + delim + j] = get[j]
        else:
            val[i] = b[i]

    return val