Json and Circular Reference Exception

前端 未结 9 1642
挽巷
挽巷 2020-11-27 03:17

I have an object which has a circular reference to another object. Given the relationship between these objects this is the right design.

To Illustrate

9条回答
  •  悲哀的现实
    2020-11-27 04:14

    Since, to my knowledge, you cannot serialize object references, but only copies you could try employing a bit of a dirty hack that goes something like this:

    1. Customer should serialize its Machine reference as the machine's id
    2. When you deserialize the json code you can then run a simple function on top of it that transforms those id's into proper references.

提交回复
热议问题