Hi Tony, Thanks for your answer. Yes, you're right, magic quotes is on - I should have thought about that...
Regards, Mickster On Aug 31, 9:55 am, Tony <[EMAIL PROTECTED]> wrote: > Hello, > usually this comes from settings on PHP. > Before get the param from php you should check if magic quotes are on. > If the are on you should apply stripslashes on this parameter. > Regards > Tony > > On Aug 31, 1:46 am, Mickster <[EMAIL PROTECTED]> wrote: > > > Hi there, > > > I've just spent an hour trying to figure out why my JSON didn't work > > on my server. It works now, but I'm a bit confused about the solution > > - maybe you guys have som input: > > My Object: > > var example = { > > id: 1, > > title: "JSON Möchtegern"} > > > I use the json2.js fromwww.json.org: > > json = JSON.stringify(example); > > This produces a seemingly correct "JSON-string": > > {"id":"1", "title":"JSON Möchtegern"} > > > I then send my data with $.ajax, using Type: Post. > > Firebug tells me the string still looks like the one above. > > > But when processing it with (PHP) json_decode($_POST['json'] the only > > response I got was an annoying "NULL". > > So I checked the string and it now looked like this: > > {\"id\":\"1\", \"title\":\"JSON Möchtegern\"} > > > So I ended up str_replace:ing all the \'s out of there and now it > > works. > > > But for all of you patient enough to read this long post, here's my > > question: > > Are you really supposed to replace all the \'s on the server side, or > > is there some option I'm missing in my AJAX-call? contentType? > > > Thanks! > > Mickster