title: How to find index of object in a array from JSON - Angular 2
body: <blockquote>
    <p>How i can find index of object in an array from JSON in a component?</p>
  </blockquote>
  
  <p>My JSON file looks like this,</p>
  
  <pre><code>{
   "Projects":[
    {
      "id":"proj-1",
      "name":"Design for creative",
      "meta":{
          "date":"03 November, 2016",
          "url":"http://www.pixelsocket.com",
      },
      {
      "id":"proj-2",
      "name":"Design for creative",
      "meta":{
          "date":"03 November, 2016",
          "url":"http://www.pixelsocket.com",
      }
      ...
  }
  </code></pre>
  
  <p>Here is my project detail component </p>
  
  <pre><code>export class ProjectDetailComponent implements OnInit{
  
  project: Project;
  
  projectId: string;
  
  totalProjects: Project[] = [];
  
  currentProjectIndex:number;
  
  
  constructor(private dataService: DataService, private route:   ActivatedRoute) {
    this.projectId = route.snapshot.params['id'];
  }
  
  ngOnInit() {
    //Getting Projects Data
    this.dataService.getProjects().then(
      (data: any) =&gt;  this.totalProjects = data
    );
  
    this.route.params
    .switchMap((params: Params) =&gt;    this.dataService.getProject(this.projectId))
    .subscribe(data =&gt; this.project = data);
   }
  }
  </code></pre>
  
  <p>Now i want to somehow get current index of object.</p>