How to Read values from nested json objects in the config.json file with the help of config service class


This is my config.json File


And below is the config service class

export class ConfigService {
  private config: Object = null;
    constructor(private http: HttpClient) {}

    public getConfig(key:any){
      return this.config[key];

    public loadConfig() {
      return this.http
        .then(Configdata => {
          this.config = Configdata;
          console.log("error duration:",Configdata);

First I want to read the value "Error" and the the value "False" and assign them to two different variables.That is,
Parameter1 = Error and
Parameter2 = false

I tried as,

let Parameter1=this.config.getConfig('Status');

then it reads,

continue: false
message: "Runtime"

But I dont get the expected output.As I want to read only the value "Error" for Parameter1

How can I read those two values from the config.json file.

Any help is appreciated.

Source: Angular Questions

Categorized as angular, config.json, nested-object Tagged , ,


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us