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 :

Since the config property is a serialized JSON string. You can work with 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.

Leave a Reply