56
rated 0 times
[
62]
[
6]
/ answers: 1 / hits: 8675
/ 10 Years ago, thu, december 18, 2014, 12:00:00
I'm creating an API that takes a JSON like this:
hightlights:[
{
title:Fun,
url:fun/index.html,
queries:
[
music,
artists,
events,
internet
]
},
{
title:Internet,
url:internet/index.html,
queries:
[
javascript,
web,
internet,
]
}
]
I need to filter the JSON with a word given by user and return with another JSON with only object that contains the word in queries.
If word === 'music', receive:
{
title:Fun,
url:fun/index.html,
queries:[
music,
artists,
events,
internet
]
}
If word === 'internet', receive:
{
{
title:Fun,
url:fun/index.html,
queries:[
music,
artists,
events,
internet
]
},
{
title:Internet,
url:internet/index.html,
queries:[
javascript,
web,
internet,
]
}
My problem is how to nest this values? If anyone can give me some example...I'll appreciate...
More From » json