access to an array inside a object in javascript?

Nacim Idjakirene

i have this code in (push notification payload) my application :

var payload = {"message":"Bundle[{id=0, title=This is a test 
notification, android.support.content.wakelockid=3, 
collapse_key=push, from=93469011985}]","inBackground":0};

And i want to access to the "id" and "title" properties in this JSON. How can i do this ? thx in advance :)

I have tried to do things like this :

console.log (payload.message['id'])

But it does not work.

user405398
var id = payload.message.substring(payload.message.indexOf("id=") + 3, payload.message.indexOf(",", payload.message.indexOf("id=")));
var title = payload.message.substring(payload.message.indexOf("title=") + 6, payload.message.indexOf(",", payload.message.indexOf("title=")));
console.log(id, title);//prints 0 This is a test notification

Warning This code will fail if you have , in the middle of the title.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

JavaScript: How to access an array object inside an object

Get access to array inside object in javascript

Access to an array inside an object

In JavaScript, how to access object properties inside an array of object?

how to access object inside an object Array which is inside another array in javascript?

How to access PHP variable inside JavaScript object array

Array inside a JavaScript Object?

Javascript: Array inside object

javascript filtering an array inside an object inside an array

Filter an array inside an object inside an array in javascript

PHP: Access element inside array inside object inside array

Object inside array inside object inside array JavaScript - Search

Why I can not access global array inside a object but inside in a prototype in javascript?

How to access an object inside an array of array

Function inside an object cannot access that object in javascript

Fill an array in javascript inside an object

Assigning array inside object in Javascript

Moving an object inside an array ( Javascript)

Access object inside the array which is inside the other object

Access Nested Object Inside Array in Angular NGXS

How to access the properties of an object inside an array?

Access element of array inside object jQuery

Access an array inside an object using Newtonsoft

How to access string and object simultaneously inside an array

access the array object inside a higher order function

Array inside an Object with specific key to access

how to access array inside object without keys

Not able to access data inside a PHP array of object

React Can't Access Array Inside Object