Added JSON support to Cost class