Clean up JSON handling in upgrade