json-server icon indicating copy to clipboard operation
json-server copied to clipboard

SyntaxError: Unexpected token '', "{ "pos"... is not valid JSON

Open ligteltelecom opened this issue 8 months ago • 2 comments

Hi can anyone help me with this issue ?

D:\projetos_angular\frontend>npx json-server db.json
<anonymous_script>:1
{
^

SyntaxError: Unexpected token '', "{
  "pos"... is not valid JSON
    at JSONFile.parse (<anonymous>)
    at JSONFile.read (file:///D:/projetos_angular/frontend/node_modules/lowdb/lib/adapters/node/DataFile.js:17:31)
    at async Observer.read (file:///D:/projetos_angular/frontend/node_modules/json-server/lib/observer.js:21:22)
    at async Low.read (file:///D:/projetos_angular/frontend/node_modules/lowdb/lib/core/Low.js:16:22)
    at async file:///D:/projetos_angular/frontend/node_modules/json-server/lib/bin.js:114:1

Node.js v22.14.0

D:\projetos_angular\frontend>

db.json below:

{ "posts": [ { "id": "1", "title": "a title" }, { "id": "2", "title": "another title" } ], "comments": [ { "id": "1", "text": "a comment about post 1", "postId": "1" }, { "id": "2", "text": "another comment about post 1", "postId": "1" } ], "profile": { "name": "typicode" } }

ligteltelecom avatar Feb 14 '25 10:02 ligteltelecom