Nested JSON: How to add (push) new items to an object?

后端 未结 4 1427
礼貌的吻别
礼貌的吻别 2020-12-02 15:53

I\'m just starting with Arrays, Objects, and JSON - so hopefully there\'s just something simple I\'m overlooking here. I\'m encountering an error when attempting to

4条回答
  •  忘掉有多难
    2020-12-02 16:18

    push is an Array method, for json object you may need to define it

    this should do it:

    library[title] = {"foregrounds" : foregrounds,"backgrounds" : backgrounds};
    

提交回复
热议问题