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

  • Home
  • SEARCH
  • 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 7943329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:14:30+00:00 2026-06-04T00:14:30+00:00

I receive string {success: false, errors: { reason: ‘text text text’ }} by CURL,

  • 0

I receive string “{success: false, errors: { reason: ‘text text text’ }}” by CURL, how to convert this string to array or object?

String ‘{“success”: “false”….}’ may be converted to object by json_decode, but I have string without qoutes.

  • 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-06-04T00:14:32+00:00Added an answer on June 4, 2026 at 12:14 am

    Use this regex first (it adds quotes)

    $json = preg_replace ('/(?<!")(?<!\w)(\w+)(?!")(?!\w)/u', '"$1"', $string);
    

    After that, you can simply use json_decode()

    $array = json_decode ($json);
    

    Update

    I found this script somewhere:

    function json_fix_quotes ($string){
        $string = str_replace("{",'{"',$string);
        $string = str_replace(":'",'":"',$string);
        $string = str_replace("',",'","',$string);
        $string = str_replace("'}",'"}',$string);
        return $string;
    }
    

    Try that instead of the regex

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

Sidebar

Related Questions

I'd like to know {insert_title_here}? I use this method, but with no success: //string
I receive a string from a database query, then I remove all HTML tags,
How can I receive a string value, find an Entity with the same name
I have a method that will receive a string , but before I can
I write the following code in simulate.jsp , to receive some String simulationInfos from
I receive a Base64 string which is actually the string representation of a PDF
After making a gzip deflate request in PHP, I receive the deflated string in
I;m trying to parse a json string which I receive from web server as
I'm having a function which receives string parameters and convert them to integers. For
These days I'm facing a problem with encoding string from an array of byte.

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.