TypeError: Converting circular structure to JSON at JSON.stringify (<anonymous>)
See original GitHub issueHere is my code:
const url = "https://subratasarkar.com/process_login.php";
const data = { action: "json_data" };
const response = await axios.post(url, data);
const jsonText = JSON.stringify(response);
const objResponse = JSON.parse(jsonText);
console.log(objResponse);
I am outputting the following simple JSON from my PHP web service:
{"id":"amzn1.account.AGABBMWJLHV7ESFWIS3F7KWVGO6Q","name":"Jenny Morrison","email":"aws.jennym@gmail.com"}
What I am doing wrong?! PS: The above JSON output is available at https://subratasarkar.com/process_login.php?action=json_data.
This is a fake user created for testing purpose only hence I am sharing the actual detail.
I actually posted it first at https://github.com/axios/axios/issues/836 then realized the thread was closed. Hence opening a new issue.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
What is TypeError: Converting circular structure to JSON?
TypeError : Converting circular structure to JSON occurs when you try to reference your variable name within the JSON object.
Read more >How can I print a circular structure in a JSON-like format?
In Node.js, you can use util.inspect(object). It automatically replaces circular links with "[Circular]". Albeit being built-in (no ...
Read more >Converting Circular Structure to JSON - Career Karma
A circular structure is an object that references itself. In the example below, we are referencing the object (obj) as a value for...
Read more >TypeError: Converting circular structure to JSON in JS
The "Converting circular structure to JSON" error occurs when we pass an object that contains circular references to the JSON.stringify() method.
Read more >TypeError: Converting circular structure to JSON - YouTube
: JSON. stringify (value); TypeError : Converting circular structure to JSON.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@emfluenceindia I will have a look and try to replicate this one for you tonight, can you let us know if the solution of #2180 worked for you on the
GET
request?response can NOT , stringify (response.data) instead