'Access JSON like object properties

I have a return object like so:

enter image description here

Can you tell me how to access its properties?

I have tried many ways with Lodash too. But no luck yet.

Failure attempts:

t.config['type']

 pick(t.config, 'type')


Solution 1:[1]

Since the config property is a serialized JSON string. You can work with it simply by deserializing it as follows

t.config = JSON.parse(T.config); 

console.log(t.config.test);

However, if you have any control over how the object t is provided to you, please (and I really mean please), fix and clean up that provider so you don't have nested, partially serialized objects. Otherwise, maintainability will suffer.

Solution 2:[2]

Simply do...

const myResponse = JSON.parse(response.config);
console.log(myResponse.type);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 power-cut