B
B
bzotsss2021-09-06 12:06:46
JavaScript
bzotsss, 2021-09-06 12:06:46

How to "reach" an array of json object on json server?

Hello everyone, I have such a json array

"tasks":[
    {
      "id": 1,
      "listId": "studing",
      "listName": "Учёба",
      "active": true,
      "tasksArray": [
        {
          "id": 0,
          "completed": true,
          "taskText": "studing tas1"
        },
},
]

I get it in its entirety with a get request at this url : http://localhost:3004/tasks
But I would like to receive EXACTLY an ARRAY of tasksArraythis object . How should the get request look like, or rather, at what url should it be carried out so that I would see such data at the given url?
{
          "id": 0,
          "completed": true,
          "taskText": "studing tas1"
        },

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Developer, 2021-09-06
@samodum

Without changing the backend - no way.
With a GET request, you receive a full JSON response from the server, and on the client side you select the necessary data.
As an option, modify the API on the server side, passing a certain parameter by which the server will return a limited amount of data

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question