🇻🇳
GPM Automate VI
  • NO-CODE AUTOMATION
    • Một số biến mặc định
    • Các block
      • Normal block
      • For
      • While
      • If
      • Else if
      • Else
    • Variables
      • Set variable
      • Increase variable
      • Decrease variable
      • Count
    • Workflow
      • Exit loop
      • Next loop
      • Delay
    • Text & number
      • Random text
      • Split text
      • Read json
      • Random number
      • Math execute
      • 2FA code
  • File & Folder
    • File exists
    • Copy file
    • Move/rename file
    • Delete file
    • File read all text
    • File read all lines
    • File write all text
    • File append line
    • Read excel file
    • Write excel file
    • Append excel file
    • Folder exists
    • Create folder
    • Move / rename folder
    • Delete folder
    • Folder get file list
  • Clipboard
    • Get clipboard text
    • Set clipboard text
  • HTTP
    • HTTP Request
    • HTTP Download
  • Image Search
    • Wait to image
    • Image exists
    • Image search
    • Ví dụ kết hợp
  • AI
    • ChatGPT
  • Mail
    • Read mail code
    • Read outlook (Oauth2)
  • Navigation
    • New tab
    • Active tab
    • Close tab
    • Go to URL
    • Back URL
    • Reload
    • Get URL
    • Wait URL Changed
  • Element
    • Wait element
    • Get element attribute
    • Get element text
    • Count element
  • Mouse
    • Mouse click
    • Mouse try to click
    • Mouse move
    • Mouse press and hold
    • Mouse release
    • Mouse scroll
  • Keyboard
    • Key press
    • File upload
    • Select dropdown
  • Scroll
    • Random scroll
    • Scroll to top
    • Scroll to bottom
    • Scroll to element
  • Switch
    • Switch to default
    • Switch to frame
    • Switch to popup
  • Cookie
    • Import cookie
    • Export cookie
  • Alert
    • Accept alert
    • Cancel alert
  • Javascript
    • Execute JS code
    • Get extension id
  • References
    • Call function
  • Google service
    • Read google sheet
    • Write google sheet
Powered by GitBook
On this page
  1. NO-CODE AUTOMATION
  2. Text & number

Read json

Đọc và phân tích dữ liệu từ định dạng JSON.

PreviousSplit textNextRandom number

Last updated 9 months ago

Ví dụ: Bạn có 1 HTTP Request như sau:

GEThttps://tools.dongvanfb.net/api/[email protected]&pass=bV1emc&type_get=imap

Kết quả trả về là 1 JSON như sau:

{
  "user": {
    "email": "[email protected]",
    "password": "bV1emc"
  },
  "status": true,
  "code": "37589",
  "timestamp": {
    "date": "15/04/2022",
    "time": "22:43"
  }
}

Để lấy giá trị code ("37589") bạn viết như sau:

Giá trị của code sẽ được lưu vào biến $ketQuaCode.

Để lấy giá trị của các thuộc tính ở tầng thấp hơn, ví dụ date ("15/04/2022") nằm trong timestamp, bạn làm như sau:

Giá trị của date sẽ được lưu vào biến $ketQuaDate.

Đối với các JSON có cả mảng dữ liệu, ví dụ như JSON $resp sau:

{
  "success": true,
  "users": [
    {
      "email": "[email protected]",
      "password": "bV1emc",
      "status": true,
      "code": "37589",
      "timestamp": {
        "date": "15/04/2022",
        "time": "22:43"
      }
    },
    {
      "email": "[email protected]",
      "password": "ax1Ym",
      "status": true,
      "code": "18554",
      "timestamp": {
        "date": "05/09/2024",
        "time": "15:12"
      }
    }
  ]
}

Để lấy giá trị date của user thứ 2, bạn viết như sau:

Ở đây users.[1].timestamp.date, thì [1] là index của mảng. Index này bắt đầu tính từ 0. Bạn cũng có thể nhúng giá trị index từ 1 biến khác vào, ví dụ [$index].

HTTP Request
HTTP Request
Read JSON
Read JSON
Read JSON
Read JSON