J
J
Jedi2017-10-04 09:54:17
JavaScript
Jedi, 2017-10-04 09:54:17

How to filter JSON?

Here I receive data in the form of JSON through web sockets, how can I implement a filter so that only those Jasons with name = Apple, Samsuka, Freelansim are displayed?
Here is Jason's example
{"name":"timeSync","msg":1507099879615}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2017-10-04
@PHPjedi

var json = {"name":"apple","msg":1507099879615}
if (json.name == 'Samsuka' || json.name == 'Apple' || json.name == 'Freelansim '){
console.log('ONO!');
}else{
console. log('NE ONO!');
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question