'How to send a multi array data to api in react native

this type of data i want to send with api from mobile in react native postcodes[postcode_0][postcode_id]

This is my code

useEffect(() => {
        const fetchstateData = async () => {

            const resMr = await axios.post
                (`${urldemo}getskills`)
            setData1(resMr.data.result)

            const responsestate = await axios.post
                (`${urldemo}states`)
            setData2(responsestate.data.result)

            const responsepostal = await axios.post
                (`${urldemo}postal-codes`)
            setData3(responsepostal.data.result)
            
            console.log("result", JSON.stringify( responsepostal, null, 2 ))
        }
        fetchstateData();
    }, []);

    const [data1, setData1] = useState([])
    const [data2, setData2] = useState([])
    const [data3, setData3] = useState([])

    const [state_id, setStateId] = useState("");
    const [postcodes, setPostcodes] = useState([]);
    const [skills, setSkills] = useState([]);

and this the code of Picker component , i don't know how to send this type of array with api

<Picker style={GlobalSS.picker}
                        selectedValue={postcodes}
                        mode='dropdown'
                        dropdownIconRippleColor='orange'
                        dropdownIconColor='#FF8025'
                        onValueChange={(itemValue, itemIndex) =>
                            setPostcodes(itemValue)
                        }>
                        <Picker.Item color='grey'
                            label="Select Postal Code " value="" />
                        {data3.map(item => (
                            <Picker.Item label={item.text} value={item.id} />
                        ))}
                    </Picker>

and i want to send post code in the below form

"postcodes": {
        "postcode_0": {
            "postcode_id": "postcode-0001"
        },
        "postcode_1": {
            "postcode_id": "postcode-0002"
        }
    },


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source