Jump to content

Recommended Posts

I'm passing 3 parameters to an ajax controller - 1 of which is JSON. When the controller gets the parameters, it fired the requested method and continues to pass along the parameters (now as 1 parameter, in the form of an array). Once inside the method, the different parameters are extrapolated from the array. However, for some reason I'm having trouble accessing my JSON input. Here's what I've got:

 

JS is sending:

["32", "33", "34", "really any number could go here..."]

 

PHP is receiving:

[\"32\", \"33\", etc, etc...]

 

Why (and where) is the PHP parsing the " in the JSON? I'm not scrubbing it until much later in the method.

 

Once I do json_decode($input['chargeID']) I get NULL as a response.

 

Any Ideas?

 

P.S. json_decode($input['chargeID'], true) does not work either.

Link to comment
https://forums.phpfreaks.com/topic/158940-json-multidimensional-arrays/
Share on other sites

Ok, scratch that. I know where the \" is coming from, that is being done via JS (Specifically the Prototype framework - .toJSON()) so a new part of my question will be going to the people on the Prototype boards, but I still wonder why does the PHP render NULL upon json_decode()?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.