I am reading JSON response into JS object. JSON source is like this:
{
"id": 1,
"email": "info@test.com",
"created_at": "2013-01-15 18:19:00.000000",
"updated_at": "2016-04-27 09:13:40.000000",
"user_profiles": {
"data": {
"first_name": "Mark",
"last_name": "Webber",
"birthday": "30.10.1979",
"company": "Company d.o.o.",
"phone": "",
"mobile": "+386 123 123 123",
"vatid": "1234567",
"custom_fields": null,
"deleted_at": null
}
}
}
I can access the properties like:
myObject.email
myObject.user_profiles.data.firstname
Is there a way to access nested properties via string? Something like
var property = "user_profiles.data.firstname"
myObject[property]