Skip to content

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

@ligteltelecom

Description

@ligteltelecom

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" } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions