Note that there are some explanatory texts on larger screens.

plurals
  1. POPull unique key names from json data, like SQL select distinct from**********
    text
    copied!<p>I have the following json data:</p> <pre><code>{ "data": [ { "name": "The Frugalicious Chef", "category": "Chef", "id": "186397894735983", "created_time": "2011-03-07T16:10:35+0000" }, { "name": "Siuslaw Broadband", "category": "Telecommunication", "id": "190373850988171", "created_time": "2011-03-06T20:21:42+0000" }, { "name": "Paul", "category": "Movie", "id": "129989595478", "created_time": "2011-03-04T19:55:18+0000" }, { "name": "Mark Zuckerberg", "category": "Public figure", "id": "68310606562", "created_time": "2011-02-16T09:50:35+0000" }, </code></pre> <p>The idea here is that I want to take this data and use parts of it. I want to create a list of the "category's" that are in the data. The problem is that there is and will be multiple items with the same category. So my list will have duplicates that I do not want. The following is how I am getting the data and converting it for use:</p> <pre><code>$jsonurl = "https://xxxxxxxxxx.com/".$fd_ID. "/info?access_token=".$session['access_token']; $likesjson = file_get_contents($jsonurl,0,null,null); $likesArray=json_decode($likesjson); </code></pre> <p>I then use a foreach to access the data.</p> <pre><code>foreach($friendLikesArray-&gt;data as $l) { etc...... } </code></pre> <p>So I guess muy question is I want to take the <code>$likesArray</code> and pull out all the unique <code>Data-&gt;Category-&gt;names</code>. Also will want to do sorting, and other things but I will get to that when the time comes.</p> <p>Thanks for the help in advance. Neil</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload