Transaction:  `toJSON` / `fromJSON` tests

- Added test to check that `toJSON` output from a Transaction could be initialized with `fromJSON`
- Fixed cases in which `toJSON` was being called instead of `toObject` within other `toObject`s