title: How to send array data to API in react native
body: <blockquote>
  <p>This is the data i want to send with API but i don't know how send it
  because its in the form of an array, specially skills and other skills
  data are in the form of array</p>
  </blockquote>
  <pre><code>&quot;job_type_id&quot;:&quot;job-type-0001&quot;,
        &quot;job_salary_type_id&quot;:&quot;job-salary-0001&quot;,
        &quot;employment_type_id&quot;:&quot;employment-type-0001&quot;,
        &quot;job_experience_id&quot;:&quot;job-experience-0001&quot;,
        &quot;postcodes&quot;: {
        &quot;postcode_0&quot;: {
        &quot;postcode_id&quot;: &quot;postcode-0001&quot;
        },
        &quot;postcode_1&quot;: {
        &quot;postcode_id&quot;: &quot;postcode-0002&quot;
        }
        },
        &quot;state_id&quot;:&quot;state-0001&quot;,
        &quot;address&quot;:&quot;address city&quot;,
        &quot;job_title&quot;:&quot;Doctor&quot;,
        &quot;job_contact_email&quot;:&quot;abc99@gmail.com&quot;,
        &quot;job_contact_number&quot;:&quot;1516555&quot;, 
        &quot;job_description&quot;:&quot;Test Description&quot;,
        &quot;max_salary&quot;:&quot;720&quot;,
        &quot;min_salary&quot;:&quot;710&quot;,
        &quot;position_no&quot;:&quot;1&quot;,
        &quot;last_apply_date&quot;:&quot;02-03-2022&quot;,
        &quot;other_skills&quot;: {
        &quot;other_skill_0&quot;: {
        &quot;title&quot;: &quot;ISO - @@ 1/&quot;
        },
        &quot;other_skill_1&quot;: {
        &quot;title&quot;: &quot;ISO - @@ 2/&quot;
        }
        },
        &quot;skills&quot;: {
        &quot;skill_0&quot;: {
        &quot;skill_id&quot;: &quot;skill-0001&quot;
        },
        &quot;skill_1&quot;: {
        &quot;skill_id&quot;: &quot;skill-0002&quot;
        },
        &quot;skill_2&quot;: {
        &quot;skill_id&quot;: &quot;skill-0003&quot;
        }
        }
       }
  </code></pre>
  <blockquote>
  <p>this is my code</p>
  </blockquote>
  <pre><code> useEffect(() =&gt; {
          const fetchstateData = async () =&gt; {
  
              const resMr = await axios.post
                  (`${urldemo}`)
              setData1(resMr.data.result);
  
              const responsestate = await axios.post
                  (`${urldemo}`)
              setData2(responsestate.data.result);
  
              const responsepostal = await axios.post
                  (`${urldemo}`)
              setData3(responsepostal.data.result);
              ;
              console.log(&quot;result&quot;, JSON.stringify( responsepostal, null, 2 ))
          }
          fetchstateData();
      }, []);
  
      const [data1, setData1] = useState([])
      const [data2, setData2] = useState([])
      const [data3, setData3] = useState([])
  
      const [state_id, setStateId] = useState(&quot;&quot;);
      const [postcodes, setPostcodes] = useState(&quot;&quot;);
      const [skills, setSkills] = useState(&quot;&quot;);
  
      const [position_no, setPosition_no] = useState(&quot;&quot;);
      const [last_apply_date, setLast_Apply_Date] = useState(&quot;&quot;);
  
      const handleSubmitButton = () =&gt; {
          
          if (!position_no || !last_apply_date || !skills) {
              showError(&quot;Fields Required&quot;)
              return;
          } else {
  
              var dataToSend = {
                  job_title: job_title,
                  job_description: job_description,
                  max_salary: max_salary,
                  min_salary: min_salary,
                  experiance: experiance,
                  salary: salary,
                  jobMode: jobMode,
                  skills: skills,
                  jobType: jobType,
                  state_id: state_id,
                  postcodes: postcodes,
                  position_no: position_no,
                  last_apply_date: last_apply_date,
  
              };
              var formBody = [];
              for (var key in dataToSend) {
                  var encodedKey = encodeURIComponent(key);
                  var encodedValue = encodeURIComponent(dataToSend[key]);
                  formBody.push(encodedKey + '=' + encodedValue);
              }
              formBody = formBody.join(' &amp; ');
  
              let data = {
                  job_title: job_title,
                  job_description: job_description,
                  max_salary: max_salary,
                  min_salary: min_salary,
                  experiance: experiance,
                  salary: salary,
                  skills: skills,
                  jobMode: jobMode,
                  jobType: jobType,
                  state_id: state_id,
                  postcodes: postcodes,
                  position_no: position_no,
                  last_apply_date: last_apply_date,
  
              };
              fetch(`API`, {
                  method: 'POST',
                  body: JSON.stringify(data),
                  headers: {
                      'Content-Type': &quot;application/json&quot;,
                      &quot;Accept&quot;: &quot;application/json&quot;,
                  },
              })
                  .then((response) =&gt; response.json())
                  .then((responseJson) =&gt; {
  
                      console.log(&quot;response.JSON ==&gt;&quot;, responseJson);
                      showError('Posted')
  
                      if (responseJson.status === 'success') {
                          console.log(
                              'Job Posted'
                          );
                          showSuccess('Successfully Posted')
                          setModalVisible(true)
                          
                      } else {
                          showSuccess(responseJson.message)
                      }
                  })
                  .catch((error) =&gt; {
                      console.error(&quot;Error Received &quot;, error);
                  });
          }
      }
  </code></pre>
  <blockquote>
  <p>and this is the UI CODE , i just add the picker component in which i
  have fetch data from API and i want to add the array data to the other
  API</p>
  </blockquote>
  <pre><code> &lt;Picker style={GlobalSS.picker}
                          selectedValue={postcodes}
                          mode='dropdown'
                          dropdownIconRippleColor='orange'
                          dropdownIconColor='#FF8025'
                          onValueChange={(itemValue, itemIndex) =&gt;
                              setPostcodes(itemValue)
                          }&gt;
                          &lt;Picker.Item color='grey'
                              label=&quot;Select Postal Code &quot; value=&quot;&quot; /&gt;
                          {data3.map(item =&gt; (
                              &lt;Picker.Item label={item.text} value={item.id} /&gt;
                          ))}
                      &lt;/Picker&gt;
  </code></pre>