jQuery Deep Copy Json Object Simple Example

  • 2021-07-02 23:04:14
  • OfStack

This paper describes a simple implementation method of jQuery deep copy Json object with an example. Share it for your reference, as follows:


var oldJson = {
  Name: 'quber',
  List: [1, 2, 3, 4],
  Obj: [
   { name: 'qubernet', fun: function () { return 1; } },
   { name: 'qubernet1', fun: function () { return 2; } }
  ]
};
var newJson = $.extend(true, {}, oldJson);
console.log(JSON.stringify(newJson));

PS: Here are some json online tools recommended for you. I believe you can use them in future development:

Online JSON code verification, verification, beautification and formatting tools:
http://tools.ofstack.com/code/json

JSON Online Formatting Tool:
http://tools.ofstack.com/code/jsonformat

Online XML/JSON interconversion tool:
http://tools.ofstack.com/code/xmljson

json code online formatting/beautification/compression/editing/conversion tool:
http://tools.ofstack.com/code/jsoncodeformat

C Language Style/HTML/CSS/json Code Formatting and Beautification Tool:
http://tools.ofstack.com/code/ccode_html_css_json

For more readers interested in jQuery related content, please check the topics of this site: "Summary of jQuery Operation json Data Skills", "Summary of jQuery Extension Skills", "Summary of jQuery Common Plug-ins and Usage", "Summary of jQuery Drag Effects and Skills", "Summary of jQuery Table (table) Operation Skills", "Summary of Ajax Usage in jquery", "Summary of jQuery Common Classic Special Effects", "Summary of jQuery Animation and Special Effects Usage" and "Summary of jquery Selector Usage"

I hope this article is helpful to everyone's jQuery programming.


Related articles: