encode json when sending to urllib