[Vuejs]-VueJS Json file with Api

2👍

The question is not very clear but if I understand correct you want to get the value from the first object depending on the status code you get from the api. In this case you need to:

Turn the json into an object, use JSON.parse()

let a = {"T1": "online", "T2": "offline"};
let b = {StatusCode: "T1"};  

you will be able to access the variable like so:

a[b.StatusCode];

Leave a comment