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

error/bug in the json server showing INT value as a STRING #1510

Closed
vazand opened this issue Jan 30, 2024 · 2 comments
Closed

error/bug in the json server showing INT value as a STRING #1510

vazand opened this issue Jan 30, 2024 · 2 comments

Comments

@vazand
Copy link

vazand commented Jan 30, 2024

Hi Json-server Team,
I have used the json-server@1.0.0-alpha.23 and there is a bug when accessing an INT value,
the actual bug is
it shows int as a string
(I have used npx json-server -p 3500 -w LuffyCrew.json)
My actual json data :
{ "luffyCrew": [ { "id": 1, "title": "Luffy's Dream", "dateTime": "2024-01-27T12:00:00", "body": "Luffy dreams of becoming the Pirate King and finding the legendary One Piece. His crew supports him in this grand adventure." }] }

Here,
It needs to show the {"id":1} Instead it shows as {"id":"1"}
this bug is not in the json-server@0.17.3

@typicode
Copy link
Owner

Hi,

It's actually not a bug. In v1 id is always a string.

I'll update the README to avoid any confusion.

@vazand
Copy link
Author

vazand commented Jan 30, 2024

Thanks Team,
I removed the OBJECT "id" from the json and ran it, looks like the json-server automatically created an OBJECT id and gave a string value for it. NICE

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

2 participants