typicode / json-server

Get a full fake REST API with zero coding in less than 30 seconds (seriously)
Other
72.89k stars 7.03k forks source link

Error with nested arrays #873

Open panayotoff opened 6 years ago

panayotoff commented 6 years ago

Hi all, I need to mock an API that consist of nested arrays, ex: db.json

{
"data": [
    [
      "id",
      "name",
      "time"
    ],
    [
     "id",
      "name",
      "time"
    ]
  ]
}

If the data is array of objects the CRUD operations works. But with nested arrays ( still valid JSON ) I get TypeError: Cannot read property 'id' of undefined at Function.createId . In my case, I don't have control over the API I have to mock, so this is the structure. Have anyone has the same problem?

Narvey commented 6 years ago

Works for me with that exact structure: https://my-json-server.typicode.com/Narvey/jsonServerTest/data

(main page at https://my-json-server.typicode.com/Narvey/jsonServerTest )