This code:
import json s = \'{ \"key1\": \"value1\", \"key2\": \"value2\", }\' json.loads(s)
produces this error in Python 2:
How about use the following regex?
s = re.sub(r",\s*}", "}", s)