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 Modifies ID Field in JSON Response When Nested Inside Projects Array #6249

Closed
amarkpc opened this issue Feb 20, 2024 · 2 comments
Closed

Comments

@amarkpc
Copy link

amarkpc commented Feb 20, 2024

Describe the bug

I've encountered an issue with Axios where it appears to be modifying the id field in a JSON response when the id field is nested inside a projects array. This behavior is unexpected and causes inconsistency in handling JSON responses.

To Reproduce

Steps to Reproduce:

  1. Make a GET request to an API endpoint using Axios.
  2. Ensure that the response contains a projects array with an id field nested inside.
  3. Log the response data to the console.
    Expected Behavior:
    The id field within the projects array should remain unchanged and match the original value in the JSON response.

Actual Behavior:
Axios appears to modify the id field within the projects array. For example, if the original id value is 123, Axios may convert it to 124 or another modified value.

Code snippet

const axios = require('axios');

axios.get('https://example.com/api/projects')
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });

Expected behavior

No response

Axios Version

1.4.0

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

20.01, 16

OS

ubuntu 22

Additional Library Versions

No response

Additional context/Screenshots

No response

@TechnoAnkush
Copy link

getting this same issue

@huzaifaazim0
Copy link

can you guys share the orignal json and response object
i was looking into it. and can't reproduce

@amarkpc amarkpc closed this as completed Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants