Combine or merge JSON on node.js without jQuery

后端 未结 18 2014
醉话见心
醉话见心 2020-12-07 17:17

I have multiple JSON like those

var object1 = {name: \"John\"};
var object2 = {location: \"San Jose\"};

They are not nesting o

18条回答
  •  萌比男神i
    2020-12-07 18:03

    I see that this thread is too old, but I put my answer here just in logging purposes.

    In one of the comments above you mentioned that you wanted to use 'express' in your project which has 'connect' library in the dependency list. Actually 'connect.utils' library contains a 'merge' method that does the trick. So you can use the 3rd party implementation without adding any new 3rd party libraries.

提交回复
热议问题