Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7626427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:19:24+00:00 2026-05-31T05:19:24+00:00

My system runs some MySQL queries in PHP to retrieve data. The data that

  • 0

My system runs some MySQL queries in PHP to retrieve data. The data that is retrieved is structured in an array similar to below:

$ret = array(
    "name" => "John Doe",
    "location" => "Antarctica",
    "description" => "Height < 200"
);

I return this through AJAX via:

echo json_encode($ret);

The AJAX error event is fired and upon inspection of the returned data (jqXHR.responseText) via Chrome console, I’m noticing:

"description" : "Height \x3c 200"

which is throwing a parse error.

I know that \x3c is the hex representation of “<” and apparently, that form renders the JSON invalid. I can’t seem to find a way to make it such that I’m able to pass the angled bracket via JSON in a valid form. Direct string replace of “\x3c” on the PHP side doesn’t work.

Further, I know that specifying the AJAX return as HTML will work, but I’m passing a set of data hence the use of JSON.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:19:25+00:00Added an answer on May 31, 2026 at 5:19 am

    Try this:

    echo json_encode( $ret, JSON_HEX_TAG );
    

    Use json_last_error() to debug.

    http://www.php.net/manual/en/function.json-decode.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a system that runs like this: main.exe runs sub.exe runs sub2.exe and
We have a system that runs in IIS. The system should always run using
I am working on a project that involves an embedded system which runs a
I have a single installation of java in a system that runs 2 or
I have a windows service that runs various system monitoring operations. However, when running
I've created a map system for a game that runs on the principle of
I'm writing an application that runs as a system daemon (root session) for Mac
I am working on a website that displays some data from DB that changes
I have a shell script that runs some acceptance tests for an application I'm
My Ant build includes a junit task that runs some tests. In order for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.