Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
How to extract multiple JSON objects from one json file located outside the app directory in angular?

I am very new to Json files. If I have a json file with multiple json objects, located outside the app asset directory in angular at /var/log, the json objects are like such as following:

{"ID":"12345","Timestamp":"20140101", "Usefulness":"Yes",
 "Code":[{"event1":"A","result":"1"},…]}
{"ID":"1A35B","Timestamp":"20140102", "Usefulness":"No",
 "Code":[{"event1":"B","result":"1"},…]}
{"ID":"AA356","Timestamp":"20140103", "Usefulness":"No",
 "Code":[{"event1":"B","result":"0"},…]}

I want to extract all "Timestamp" and "Usefulness" into a data frames in angular js, this is my code:

import { Component, Input } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
//import json from '../../../../../../../../var/log/suricata/eve.json';
import data from "../../../../../../../../var/log/suricata/eve.json";
import { ClassToggleService, HeaderComponent } from '@coreui/angular';

@Component({
  selector: 'app-default-header',
  templateUrl: './default-header.component.html',
})
export class DefaultHeaderComponent extends HeaderComponent {

  @Input() sidebarId: string = "sidebar";

  public newMessages = new Array(4)
  public newTasks = new Array(5)
  public newNotifications = new Array(5)


  constructor(private classToggler: ClassToggleService) {
    super();
    
    let products: any = (data as any).default;
    const myJSON = JSON.stringify(products);
    var res = JSON.parse('[' + products.replace(/}}}{/g, '}}},{') + ']');
    console.log(res);
    //console.log(data.timestamp);
    //console.log(data.stats.uptime);
  }
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!