Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
No funcionó convertir la cadena decodificada JSON en matriz en PHP que se envía mediante el método Ajax

tengo un objeto JS

 data=[{'quest':'sometext'},{'option':['a','b', 'c']}, {'cor':[0,1,0]},{'sol':'again tetx'}]

Enviado como datos Ajax usando JQuery

 ... data:{'qs':JSON.stringify(data)}, ...

Recibí el mensaje e intenté convertirlo en una matriz

 $array=json_decode(json_encode($_POST['qs']), true);

pero la salida es

 print_r($array); \\is [{"quest":"sometext"},{"option":["a","b", "c"]}, {"cor":[0,1,0]},{"sol":"again tetx'}]

Quiero hacer una matriz en PHP

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

$array = json_decode($_POST['qs'], true); print_r($array);

Producción:

 Array ( [0] => Array ( [quest] => sometext ) [1] => Array ( [option] => Array ( [0] => a [1] => b [2] => c ) ) [2] => Array ( [cor] => Array ( [0] => 0 [1] => 1 [2] => 0 ) ) [3] => Array ( [sol] => again tetx ) )
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!