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

149
Views
Didn't work convert JSON decoded string to array in PHP which is send by Ajax method

I have JS object

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

Submited as Ajax data using JQuery

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

I received the as post and try to convert to array

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

but output is

print_r($array); \\is

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

I want to make it array in PHP

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

0

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

Output:

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!