if not sorted_keys:
    return json.dumps(data)
else:
    out_list = []
for element in data:
    element_list = []
for key in sorted_keys:
    if key in element:
        element_list.append(json.dumps({key: element[key]}))
out_list.append('{{{}}}'.format(','.join(s[1:-1] for s in element_list)))
return '[{}]'.format(','.join(out_list))
custom JSON sort_keys order in Python