function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mahesh Tandan 6Mahesh Tandan 6 

json parsing

I need help developers
I have json data that I need to parse

Structure is this

I only need bold array value


Please help
{
    "id": "5BS9022******",
    "intent": "CAPTURE",
    "purchase_units": [
        {
            "reference_id": "default",
            "amount": {
                "currency_code": "USD",
                "value": "10.00"
            },
            "payee": {
                "email_address": "Busyaccount@exmaple.com",
                "merchant_id": "ZJCWA********"
            },
            "soft_descriptor": "PAYPAL *JOHNDOESTES",
            "shipping": {
                "name": {
                    "full_name": "Buyer Name"
                },
                "address": {
                    "address_line_1": "Buyer address",
                    "admin_area_2": "",
                    "admin_area_1": "GA",
                    "postal_code": "123456",
                    "country_code": "US"
                }
            },
            "payments": {
                "captures": [
                    {
                        "id": "31349714C********",
                        "status": "COMPLETED",
                        "amount": {
                            "currency_code": "USD",
                            "value": "10.00"
                        },
                        "final_capture": true,
                        "seller_protection": {
                            "status": "ELIGIBLE",
                            "dispute_categories": [
                                "ITEM_NOT_RECEIVED",
                                "UNAUTHORIZED_TRANSACTION"
                            ]
                        },
                        "seller_receivable_breakdown": {
                            "gross_amount": {
                                "currency_code": "USD",
                                "value": "10.00"
                            },
                            "paypal_fee": {
                                "currency_code": "USD",
                                "value": "0.59"
                            },
                            "net_amount": {
                                "currency_code": "USD",
                                "value": "9.41"
                            }
                        },
                        "links": [
  
                        ],
                        "create_time": "2020-02-06T04:00:56Z",
                        "update_time": "2020-02-06T04:00:56Z"
                    }
                ]
            }
        }
    ],
    "payer": {
        "name": {
            "given_name": "buyer Name",
            "surname": "Name"
        },
        "email_address": "testbuyer@example.com",
        "payer_id": "A8******",
        "address": {
            "country_code": "US"
        }
    },
    "create_time": "2020-02-06T03:59:18Z",
    "update_time": "2020-02-06T04:00:56Z",
    "links": [

    ],
    "status": "COMPLETED"
}


 
Foram Rana RForam Rana R
Hi Mahesh,

You can use Online tool:

Please go through below link, that might help you :

https://json2apex.herokuapp.com/

Thanks,
Foram Rana
Mahesh Tandan 6Mahesh Tandan 6
Hello Foram Rana R

Thank you for replay

but I need to parse this in apex class
how can I do this?
Foram Rana RForam Rana R
Okay
Follow the below reference code :
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_json_jsonparser.htm