title: How to parse JSON array from a GET request in react-native?
body: <p>I am making GET request call from my react-native code and the response of the GET request is like below-</p>
  
  <pre><code>[
      {
          "id": 1,
          "title": "homework",
          "detail": "nothing details",
          "status": "1",
          "url": "www.google.com",
          "mail": "a@a.com",
          "phone": "0171551223366",
          "category": "2",
          "timestamp": 12.3
      },
      {
          "id": 2,
          "title": "homework",
          "detail": "nothing details",
          "status": "1",
          "url": "www.google.com",
          "mail": "a@a.com",
          "phone": "0171551223366",
          "category": "2",
          "timestamp": 12.3
      }
  ]
  </code></pre>
  
  <p>In case, if it was a simple json response, there was no problem at all with parsing but in case, this is an array, I am not getting how to get and save them in an array.</p>
  
  <p>Here I have given my code-</p>
  
  <pre><code>import React from 'react';
  import { StyleSheet, Text, View, Image, AsyncStorage, ActivityIndicator } from 'react-native';
  import {Icon, Button, Container, Header, Content, Left} from 'native-base';
  import CustomHeader from './CustomHeader';
  
  let jwt=''
   class NoteMeHome extends React.Component {
  
  
     state = {
        getValue: '',
        dataSource:[],
        isLoading: true
      }
  
  
    componentDidMount() {
      AsyncStorage.getItem("token").then(value =&gt; {
        console.log(value);
        jwt = value;
  
        this.setState({
          getValue: value,
        });
      });
  
      const url = 'my url';
      fetch(url, {
        method: 'GET',
        headers: new Headers({
          'Content-Type' : 'application/json',
          'token': 'abcd',
          'jwt': jwt
        })
      })
      .then((response)=&gt; response.json() )
      .then((responseJson) =&gt; {
        console.log('####:'+responseJson.title)
        this.setState({
          dataSource: responseJson,
          isLoading: false
        })
      })
      .catch((Error) =&gt; {
        console.log(Error)
      })
  
  
    }
  
    static navigationOptions = ({navigation}) =&gt; ({
      title: "Home",
      headerLeft: &lt;Icon name="ios-menu" style={{paddingLeft:10}}
      onPress={()=&gt;navigation.navigate('DrawerOpen')}/&gt;,
  
      drawerIcon: 
  
      &lt;Image source={{uri: 'https://png.icons8.com/message/ultraviolet/50/3498db'}}
              style={styles.icon}
      /&gt;
    })
  
  
  
    render() {
      const { getValue } = this.state;
  
      return(
        this.state.isLoading
        ?
        &lt;View style={{flex:1, justifyContent:'center', alignItems:'center'}}&gt;
          &lt;ActivityIndicator size="large" color="#330066" animating/&gt;
        &lt;/View&gt;
        :
        &lt;Container&gt;
          &lt;CustomHeader
            title="Home"
            drawerOpen={()=&gt;this.props.navigation.navigate('DrawerOpen')}
          /&gt;
          &lt;Content contentContainerStyle={{flex:1, alignItems:'center', 
          justifyContent:'center', padding:10}}&gt;
          &lt;Button full onPress={()=&gt; this.props.navigation.navigate('Settings')}&gt;
            &lt;Text style={{color:'white'}}&gt;Go To Settings&lt;/Text&gt;
          &lt;/Button&gt;
          &lt;Text&gt;{this.state.getValue}&lt;/Text&gt;
          &lt;/Content&gt;
        &lt;/Container&gt;
      )
    }
  
  
  
  }
  
  
  
  const styles = StyleSheet.create({
    icon:{
      height: 24,
      width: 24
    }
  })
  export default NoteMeHome;
  </code></pre>
  
  <p>So, it would be very nice if anyone helps me out with this code and suggest how save the data from json response to an array.</p>