Fix the environment parsing when writing out the env json