Define “cyclic data structures”

前端 未结 9 1944
鱼传尺愫
鱼传尺愫 2021-02-02 09:33

At the JSON site it says

JSON does not support cyclic data structures, so be careful to not give cyclical structures to the JSON stringifier.

<
9条回答
  •  旧巷少年郎
    2021-02-02 10:05

    if you have:

    var a = {value: 'a'};
    var b = {value: a};
    var c = {value: a};
    

    In JSON for b it would look like:

    "{value: {value: 'a'}}"
    

    In JSON for c it would look like:

    "{value: {value: 'a'}}"
    

    No pointers.

提交回复
热议问题