2 years ago

#74757

test-img

boylang78

Cannot access child value on Newtonsoft.Json.Linq.JValue error?

string shippingContactFullName = (string)json["billing_address"]["contact_full_name"];

On this line, i get the

Cannot access child value on Newtonsoft.Json.Linq.JValue error

The ShippingAddress element is working. But I'm getting the error you see in the BillingAdress element.

How can I solve this problem?

JSON:

{
    "id": 53245235,
    "service": 2,
    "service_name": "n11",
    "service_logo": "https://dopigo.s3.amazonaws.com/integration_logos/n11_2.png",
    "sales_channel": "n11",
    "service_created": "2022-01-20T00:59:00+03:00",
    "service_value": "207843149357",
    "service_order_id": "298190201",
    "products": "3 X (216109) Akü Kutup Başı - Zamak Malzeme<br>3 X (216109) Akü Kutup Başı - Zamak Malzeme<br>",
    "customer": {
        "id": 26207836,
        "account_type": "person",
        "full_name": "tuncay poyraz",
        "address": {
            "id": 81237558,
            "full_address": "Foça Mh.  Foca mah 1041 sok kapi daire 11/6 s blok fethiye - FETHİYE/Muğla/TürkiyeFOÇA /FETHİYE /MuğlaT",
            "contact_full_name": null,
            "contact_phone_number": null,
            "city": "Muğla",
            "district": "Fethiye",
            "zip_code": null
        },
        "email": "tayfun6023@gmail.com",
        "phone_number": "+905536925506",
        "citizen_id": 38576088320,
        "tax_id": null,
        "tax_office": null,
        "company_name": null,
        "service_data_mappings": [
            {
                "service_data": {
                    "service": {
                        "name": "n11"
                    },
                    "service_value": "17878401"
                }
            }
        ]
    },
    "billing_address": {
        "id": 81237553,
        "full_address": "Foça Mh.  Foca mah 1041 sok kapi daire 11/6 s blok fethiye - FETHİYE/Muğla/TürkiyeFOÇA /FETHİYE /MuğlaT",
        "contact_full_name": "bekir dirican",
        "contact_phone_number": "+905536925506",
        "city": "Muğla",
        "district": "Fethiye",
        "zip_code": "48300"
    },
    "shipping_address": {
        "id": 81237554,
        "full_address": "Foça Mh.  Foca mah 1041 sok kapi daire 11/6 s blok fethiye - FETHİYE/Muğla/TürkiyeFOÇA /FETHİYE /MuğlaT",
        "contact_full_name": "bekir dirican",
        "contact_phone_number": "+905536925506",
        "city": "Muğla",
        "district": "Fethiye",
        "zip_code": "48300"
    },
    "shipped_date": null,
    "payment_type": "cc",
    "status": "waiting_shipment",
    "total": "54.00",
    "service_fee": null,
    "discount": null,
    "archived": false,
    "notes": null,
    "items": [
        {
            "id": 35478059,
            "order": 53245235,
            "service_item_id": "319332749",
            "service_product_id": "524383019",
            "service_shipment_code": null,
            "sku": "216109",
            "attributes": "Kutup Yön Seçin: Eksi Kutup (-), ",
            "name": "Akü Kutup Başı - Zamak Malzeme",
            "amount": 3,
            "price": "27.00",
            "unit_price": "9.00",
            "shipment": null,
            "shipment_campaign_code": "112064897331519",
            "buyer_pays_shipment": false,
            "status": "approved",
            "shipment_provider": 3,
            "tax_ratio": 18,
            "product": {
                "id": 17022813,
                "sku": "AK-KTP-BS-MLZM-2",
                "foreign_sku": "216109E"
            },
            "linked_product": {
                "id": 17022813,
                "sku": "AK-KTP-BS-MLZM-2",
                "foreign_sku": "216109E"
            },
            "vat": null
        },
        {
            "id": 35478058,
            "order": 53245235,
            "service_item_id": "319348650",
            "service_product_id": "524383019",
            "service_shipment_code": null,
            "sku": "216109",
            "attributes": "Kutup Yön Seçin: Artı Kutup (+), ",
            "name": "Akü Kutup Başı - Zamak Malzeme",
            "amount": 3,
            "price": "27.00",
            "unit_price": "9.00",
            "shipment": null,
            "shipment_campaign_code": "112064897331519",
            "buyer_pays_shipment": false,
            "status": "approved",
            "shipment_provider": 3,
            "tax_ratio": 18,
            "product": {
                "id": 17022810,
                "sku": "AK-KTP-BS-MLZM",
                "foreign_sku": "216109A"
            },
            "linked_product": {
                "id": 17022810,
                "sku": "AK-KTP-BS-MLZM",
                "foreign_sku": "216109A"
            },
            "vat": null
        }
    ],
    "transactions": [
        {
            "transaction_type": "income",
            "payment_type": "undefined",
            "additional_description": "Gelir",
            "paid_date": "2022-01-20T00:59:00+03:00",
            "payment_due_date": null,
            "invoice_number": null,
            "invoice_file": null,
            "service_document_url": null,
            "total": "54.00",
            "archived": false,
            "installment_count": null,
            "pos_ref_id": null,
            "bank_id": null,
            "account_id": null
        },
        {
            "transaction_type": "expense",
            "payment_type": "undefined",
            "additional_description": "komisyon",
            "paid_date": "2022-01-20T00:59:00+03:00",
            "payment_due_date": null,
            "invoice_number": null,
            "invoice_file": null,
            "service_document_url": null,
            "total": "5.40",
            "archived": false,
            "installment_count": null,
            "pos_ref_id": null,
            "bank_id": null,
            "account_id": null
        }
    ],
    "invoice_number": "PA02022000000294",
    "invoice_created": "2022-01-20T06:23:05.608248Z",
    "invoice_type": "e-archive",
    "invoice_vat_total": 8.24,
    "invoice_grand_total": 54.0,
    "invoice_deleted": false,
    "created": "2022-01-20T01:09:21.717504+03:00"
}

c#

json

json.net

0 Answers

Your Answer

Accepted video resources