Extracting data from a JSON file through looping - 7.3

Extracting data from a JSON file through looping

Version
7.3
Language
English
Module
Talend Studio
Content
Last publication date
2024-02-21

For more technologies supported by Talend, see .

This scenario describes a Job that extracts data from a JSON file through multiple loops and displays the data on the console.

The following lists the content of the JSON file, sample.json.

{
    "Guid": "a2hdge9-5517-4e12-b9j6-887ft29e1711",
    "Transactions": [
        {
            "TransactionId": 1,
            "Products": [
                {
                    "ProductId": "A1",
                    "Packs": [
                        {
                            "Quantity": 20,
                            "Price": 40.00,
                            "Due_Date": "2019/03/01"
                        }
                    ]
                }
            ]
        },
        {
            "TransactionId": 2,
            "Products": [
                {
                    "ProductId": "B1",
                    "Packs": [
                        {
                            "Quantity": 1,
                            "Price": 15.00,
                            "Due_Date": "2019/01/01"
                        },
                        {
                            "Quantity": 21,
                            "Price": 315.00,
                            "Due_Date": "2019/02/14"
                        }
                    ]
                }
            ]
        },
        {
            "TransactionId": 3,
            "Products": [
                {
                    "ProductId": "C1",
                    "Packs": [
                        {
                            "Quantity": 2,
                            "Price": 5.00,
                            "Due_Date": "2019/02/19"
                        },
                        {
                            "Quantity": 3,
                            "Price": 7.50,
                            "Due_Date": "2019/05/21"
                        }
                    ]
                }
            ]
        }
    ]
    }

This Job extracts the values of the following elements.

  • Guid
  • TransactionId
  • ProductId
  • Quantity
  • Price
  • Due-Date