import json


def convert(x):
    """ Convert a json string to a flat python dictionary
    which can be passed into Pandas. """
    ob = json.loads(x)
    for k, v in ob.items():
        if isinstance(v, list):
            ob[k] = ",".join(v)
        elif isinstance(v, dict):
            for kk, vv in v.items():
                ob["%s_%s" % (k, kk)] = vv
            del ob[k]
    return ob