Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

170
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda