I need a way of searching a JSON object based on an ID in the object. I want to use the data in the object for a JS template.
In the moments
object there are multiple (data-stamped named) arrays containing multiple objects.
I am happy to use jQuery.
Here is my JavaScript object example:
{
"moments": {
"20150608": [
{
"id": 2,
"created": "2015-06-10T09:28:59+00:00",
"updated": "2015-06-10T09:28:59+00:00",
"title": "...",
"emotion": "...",
"context": "...",
"description": "...",
"published": "2015-06-09T22:34:27+00:00",
"live": true,
"deleted": false,
"metric": "bio",
"image_id": "5578035a6996d.jpg"
},
{
"id": 3,
"created": "2015-06-10T09:28:59+00:00",
"updated": "2015-06-10T09:28:59+00:00",
"title": "...",
"emotion": "...",
"context": "...",
"description": "...",
"published": "2015-06-09T22:34:27+00:00",
"live": true,
"deleted": false,
"metric": "soc",
"image_id": "5578035a6996d.jpg"
}
],
"20150609": [
{
"id": 1,
"created": "2015-06-10T09:28:59+00:00",
"updated": "2015-06-10T09:28:59+00:00",
"title": "...",
"emotion": "...",
"context": "...",
"description": "...",
"published": "2015-06-09T22:34:27+00:00",
"live": true,
"deleted": false,
"metric": "bio",
"image_id": "5578035a6996d.jpg"
},
{
"id": 4,
"created": "2015-06-10T09:28:59+00:00",
"updated": "2015-06-10T09:28:59+00:00",
"title": "...",
"emotion": "...",
"context": "...",
"description": "...",
"published": "2015-06-09T22:34:27+00:00",
"live": true,
"deleted": false,
"metric": "atm",
"image_id": "5578035a6996d.jpg"
}
]
}
}