I have looked at many posts on this forum and still having problems, can't get my head round it.

i am retreiving a php page through ajax which is posting a json object:

```
$.ajax({
    url: myUrl,
    data: sendData,
    type: "POST",
    error: function(xhr, statusText, errorThrown){
    // Work out what the error was and display the appropriate message
    },
    success: function(data){
    // data retrived ok
    var myData = data;
        // do something with data
    }
});

```

my json is like this (generated with js):

```
{"borough": {"id": "3"}, "cat":{"id": "5", "id": "47", "id": "98"}}

```

using firebug i have hecked and its getting passed across

my problem is with the php, i cant seem to get the data json\_decoded.

```
<?php
    $catPost = $_POST['cat'];
    echo($catPost);
    $catData = json_decode($catPost, true);
    var_dump($catData);
?>

```

the echo statement prints out [object Object]

but the var\_dump prints out null

what am i doing wrong? how do i access the diffirent "id" values in the data????

any help greatly appreciated.

the test page can be seen at [http://http://www.reelfilmlocations.co.uk/NEW Search/fullsearch\_jq.php](http://www.reelfilmlocations.co.uk/NEW%20Search/fullsearch_jq.php)

Instructions for testing:
(use thetext "Advanced search" under the select category dropdown to perform the ajax call
also select a borough and somecategories topopulate the json object with some data

EDIT:

the json is created by the following script which reads values of selected tages from an array:

```
var sendData = {"borough":[], "cat":[]};
//alert('borough tagger add '+BoroughTagger.myIdArray[intIndex]);
sendData.borough.push({"id":BoroughTagger.myIdArray[intIndex]});
$.each(CatTagger.myIdArray, function(intIndex, objValue) {
    alert('cat Tagger add '+CatTagger.myIdArray[intIndex]);
    sendData.cat.push({"id":CatTagger.myIdArray[intIndex]});
});

```

which would create a json object like the following: (checked this in fiebug)

```
{"borough": {"id": "3"}, "cat":{"id": "5", "id": "47", "id": "98"}}

```

I am now using `stringData = JSON.stringify(sendData)` to send the data via ajax
but there dosent seem to be any name in the post collections, the string is there but if i reference it using `$myData = $_POST;` which echos "ArrayArray"
the json\_decode errors with: Warning: json\_decode() expects parameter 1 to be string, array given in D:\wamp\www\ReelFilm\NEW Search\getAdvSearch.php on line 7 

so how do i get the ajax call to assign a name tothe sent sata so i can access it using `$_POST['myData']`