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

number and text problem #1609

Open
Puxxx opened this issue Sep 9, 2024 · 1 comment
Open

number and text problem #1609

Puxxx opened this issue Sep 9, 2024 · 1 comment

Comments

@Puxxx
Copy link

Puxxx commented Sep 9, 2024

I found this front-end tools from https://rtool.cn/jsonserver/docs/relationships, and I download the db.json to localhost, and command the stings "json-server --watch db.json"
Then I use http://localhost:3000/posts/1?_embed=comments, json resualt return like this
{
"userId": 1,
"id": "1",
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto",
"comments": []
}

but when I use the url https://jsonplaceholder.typicode.com/posts/1?_embed=comments, json resualt return like this

{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto",
"comments": [
{
"postId": 1,
"id": 1,
"name": "id labore ex et quam laborum",
"email": "[email protected]",
"body": "laudantium enim quasi est quidem magnam voluptate ipsam eos\ntempora quo necessitatibus\ndolor quam autem quasi\nreiciendis et nam sapiente accusantium"
},……
]
}

so I find the diffence:
the website json return "id": 1 , id value is 1,but the local json return "id": "1", id value is "1".so why could this happen?

@Iamhhp
Copy link

Iamhhp commented Nov 10, 2024

Yes, this is my problem too.
And When the id property is a number, when we request the following endpoint, the value Not Found
But when the id property is a string, when we request the same endpoint, it will return the desired data.
This problem did not exist in the early versions

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