I'm not sure if I'm understanding clearly, but are you trying to
access object parameters in your callback? If so, you would access
them like:

$.post('spit.php', complexJSON , function(txt){
    console.log(txt.title);
    console.log(txt.playlist.url);
}

And out would come:

abcd
url
(with no linebreak)

Does this make sense? Or am I missing it.

On Jul 10, 1:07 pm, lionstone <[EMAIL PROTECTED]> wrote:
> Hi, I am having trouble using $.post with complex JSON structures.
> Specifically, when I post an object that contains an object or array
> as a value, the nested object posts as the string "[object+object]" .
> Sample code:
>
> sampleJSON = {};
> sampleJSON = { "a" : "b", "c" : {"d": "e", "f":"g"}, "h": "i"};
> $.post('spit.php', sampleJSON , function(txt){ console.log(txt); } );
>
> What I am really hoping to do is:
>
> complexJSON = {};
> complexJSON = {"title":"abcd", "playlist": [ {"url": "url" }, {"url":
> "url" }, {"url": "url" } ] }
> $.post('spit.php', complexJSON , function(txt){ console.log(txt); } );
>
> I've been really banging my head over this one, so all suggestions
> would be greatly appreciated :) Thanks!

Reply via email to