‘Converting circular structure to JSON‘ error
Problem Description: the project needs to transfer strings to the background, so the object needs to be converted,
but JSON is used There is a bug of circular reference in the object during stringify (data) conversion, and we can’t find out where the copy is wrong.
The plug-in CircularJSON is used here to ignore circular references and force conversion
// install
npm install -S circular-json
// import
import CircularJSON from 'circular-json'
// conversion
let data= CircularJSON.stringify(data)
let data= CircularJSON.parse(data)
Read More:
- [Solved] TypeError: Converting circular structure to JSON – JSON.stringify
- How to Solve JS error: Unexpected end of JSON input,Unexpected token u in JSON at position 0
- Json.parse: All Error & How to Solve Them
- Golang: How to determine structure whether it is empty
- [Go] Can structure/structure pointer be compared with operator == is not defined error
- [Solved] JSON.parse() Error: Unexpected end of JSON input
- [Solved] VS Code Error: Vetur can‘t find ‘tsconfig.json‘ or ‘jsconfig.json‘
- [Chrome]: DevTools failed to load source map… (How to Solve)
- React: How to Solve Web3 import error
- How to Solve Vite package error
- How to Solve VUE Error: Mixed spaces and tabs
- VUE: How to Solve NPM Always Install Error
- How to Solve Vscode save Vue file eslint error
- How to Solve React devtools plug-in Error
- How to Solve Phantomjs prebuilt error
- Vue: How to Solve error avoided redundant navigation to current location: “/xxx”
- How to Solve “Vue is not defined” Error
- How to Solve Vue-devtool Package Error
- How to Solve QT uses MSVC compiler to code error
- How to Solve Nodejs error: cannot find module ‘. /application’