json-server
json-server copied to clipboard
number and text problem
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?