I have JSON look like this
[{"id":"7","name":"hello","username":"hell7s692","password":"dAggzyFMnBXq3RjoTWoJ3ndBkGhyU6njT2ZPlNfXVV8+XU3vvrTaULUAbPcmsqgj1NpXOpzieKRXWox\/BVcYrA==","email":"hello@gmail.com","mobile_number":"7736527089","address":"hello","date":"24 Jan 2016 12:14:02","active":"1","commission":"5"},
{"id":"7","name":"hello","username":"hell7s692","password":"dAggzyFMnBXq3RjoTWoJ3ndBkGhyU6njT2ZPlNfXVV8+XU3vvrTaULUAbPcmsqgj1NpXOpzieKRXWox\/BVcYrA==","email":"hello@gmail.com","mobile_number":"7736527089","address":"hello","date":"24 Jan 2016 12:14:02","active":"1","commission":"5"}
]
From this i want to get the new json that matches the condition in like query
ie i want to get the json with the condition
get all the json object with name start with a letter
Similar mysql query where name like he%
Currently i know about only matches
but it returns the array with only exact match.
var users = [
{ 'user': 'barney', 'age': 36, 'active': true },
{ 'user': 'fred', 'age': 40, 'active': false }
];
_.filter(users, _.matches({ 'age': 40, 'active': false }));
// → [{ 'user': 'fred', 'age': 40, 'active': false }]
This will returns with only exact match.