replace direct json manipulation in tests with object usage.