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

262
Views
PHP/Ajax Unserialize to JSON

I have an issue where I’m doing this with AJAX

$('form').serialize()

I than convert it or "Unserialize" it with PHP using:

$params = array();
parse_str($_POST['data'], $params);
echo $params['name'];

I then use json_encode($params); and save to a file.

My issue is, when I use a character like ’ or - for example, it serialises it to \u2019 or \u2010 which I don't want, I want it stored as ’ or ‐ in JSON. I've tried absolutely everything to convert it.

I assume my point of conversion is on $params['name'] before being saved to JSON, I tried flags like JSON_UNESCAPED_UNICODE but this isn't it either. I don't have iconv or mb_ libraries to convert using those.

I believe the \u2019 is Unicode? and I need it converted to an HTML entity and then saved to JSON as an HTML entity.

I know this is very bizarre, but it’s for a very specific reason, and I’ve spent about 5 hours now on Google and I’m depleted.

I’ve come to the conclusion there is no native PHP function that’ll do it, but is there a function someone has written available? or do I need to get iconv or mb?

over 4 years ago · Santiago Trujillo
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!