Add WriteJSON and WriteToJSON methods to CBORObject, and fix bugs in CBORObject Add and Set methods