C
C
cicec2016-05-23 22:27:20
Delphi
cicec, 2016-05-23 22:27:20

How to link together the data received on two pages?

Good day!
There is such a task:
I make a GET request to the page, it gives me the result in JSON, I rip out the id from there, and write them in one line:

if JSON.TryGetValue<TJSONArray>('response.items', JSONArr) then
      begin 
        for I := 0 to JSONArr.GetValue<TJSONArray>.Count - 1 do
        begin
          if I > 0 then
            user_id_list := user_id_list + ',' + JSONArr.GetValue<string>('[' + IntToStr(i) + '].message.user_id')
          else
            user_id_list := JSONArr.GetValue<string>('[' + IntToStr(i) + '].message.user_id');
        end;
      end;

{
  "response": {
    "count": 3,
    "items": [
      {
        "message": {
          "user_id": 1,
          "body": "Текст body"
        }
      },
      {
        "message": {
          "user_id": 2,
          "body": "Текст body"
        }
      },
      {
        "message": {
          "user_id": 3,
          "body": "Текст body"
        }
      }
    ]
  }
}

(and I also need to tear out the body from there, past the id )
now I need to make a request to another page with the id list ( user_id_list ) (1,2,3), where I get 3 more text fields for each id:
{
  "response": [
    {
      "id": 1,
      "first_name": "Текст1",
      "last_name": "Текст1",
      "photo_50": "http"
    },
    {
      "id": 2,
      "first_name": "Текст2",
      "last_name": "Текст2",
      "photo_50": "http"
    },
    {
      "id": 3,
      "first_name": "Текст3",
      "last_name": "Текст3",
      "photo_50": "http"
    }
  ]
}

and now I need to link all this data received on 2 pages and display it in memo, i.e. to get:
id:1, Text body, Text1 Text1, http
id:2, Text body, Text2 Text2, http
id:3, Text body, Text33 Text3, http

How to do it better and more correctly? I hope I explained clearly.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question