Display JSON in React Native

Jasur Kurbanov

I have this JSON file in local machine. How to get value Experiences>roles>title . Project in react native.

"Experiences": [
{
  "companyName": "Demo1 Technologies",
  "logo": "https://upload.wikimedia.org/wikipedia/commons/a/ac/No_image_available.svg",
  "url": "https://www.google.com/",
  "roles": [
    {
      "title": "Full Stack Developer",
      "description": "Built and updated various Chrome Extensions.",
      "startDate": "2017-01-01",
      "endDate": "2017-05-01",
      "location": "New York, USA"
    }
  ]
},
akhtarvahid

In react native

const data = JSON.parse(JSON.stringify([
  {
    "companyName": "Demo1 Technologies",
    "logo": "https://upload.wikimedia.org/wikipedia/commons/a/ac/No_image_available.svg",
    "url": "https://www.google.com/",
    "roles": [
      {
        "title": "Full Stack Developer",
        "description": "Built and updated various Chrome Extensions.",
        "startDate": "2017-01-01",
        "endDate": "2017-05-01",
        "location": "New York, USA"
      }
    ]
  }]));
class App extends Component {
  render() {
    return (
      <FlatList
        data={data}
        renderItem={({ item }) => {
          return (
            <View>
              <Text>{item.roles[0].title}</Text>
            </View>
          );
        }}
      />
    );
  }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related