Description of Array in API Parameters

Asked 1 years ago, Updated 1 years ago, 68 views

Thank you for browsing.
I am currently studying Python and am writing a program using the API.
However, I would like to use the array for the values to be set in the parameters, but it doesn't work.
How should I describe it?

It may be difficult to understand, but could you tell me...

json_data={
    'destination': {
        'XXX': XX,
    },
    'source': {
        'ipRanges': [
            "11111", // ★ I want to arrange it here
            "22222" // ★ I want this to be an array
          ]
    }
}

python aws api

2022-09-30 20:17

1 Answers

I think it would be better to simply nest the array as shown below.
This should be valid data for JSON.

{
    "destination": {
        "XXX" : 0
    },
    "source": {
        "ipRanges": [
            [
                "11111",
                "22222"
            ],
            [
                "33333",
                "44444"
            ]
          ]
    }
}

For example, you can check online on a site like this.
JSON Validator

Actually, not only the format of the data to be sent, but also the person who receives it and processes it needs to deal with it, but isn't it possible that they haven't done it yet?


2022-09-30 20:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.