Added ToJSON and FromJSON instances.