Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading