Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

axios Converting circular structure to JSON #1220

Closed
DanielWLam opened this issue Dec 5, 2017 · 4 comments
Closed

axios Converting circular structure to JSON #1220

DanielWLam opened this issue Dec 5, 2017 · 4 comments

Comments

@DanielWLam
Copy link

I am coming across this problem. Simply use async await and axois for an api. And it give the feed back with 'Converting circular structure to JSON'. Any solution?

async get (url) {
  const result = await axios.get('https://cnodejs.org/api/v1/topics')
  return result
}

BTW, https://cnodejs.org/api/v1/topics, you can just click this link, the api response find.

@cameronpickham
Copy link

Try return result.data

@nullRefErr
Copy link

@cameronpickham I'm getting this error, I tried your solution but still the same.

@DanielWLam
Copy link
Author

@cameronpickham works for me, thanks~!

@luscas
Copy link

luscas commented Jun 9, 2019

You can use destructuring assignment

async get (url) {
  const { data: result } = await axios.get('https://cnodejs.org/api/v1/topics')
  return result
}

@axios axios locked and limited conversation to collaborators May 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants