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 7984881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:24:39+00:00 2026-06-04T11:24:39+00:00

I have the following PHP string: {‘blah’:1178,’blah’:0,’blah’:260,’blah’:0,’needWrapper’: {‘NEED’:’TEXTNEED’,’NEED’:’TEXTNEED’}, ‘blah’:’blah’} EDIT: I broke it up

  • 0

I have the following PHP string:

“{‘blah’:1178,’blah’:0,’blah’:260,’blah’:0,’needWrapper’:

{‘NEED’:’TEXTNEED’,’NEED’:’TEXTNEED’}, ‘blah’:’blah’}”

EDIT: I broke it up to hopefully make it more readable

I need to get the “NEED: TEXTNEED” and “NEED: TEXTNEED” substrings from that. I feel like there’s a good way to do that with regex’s or using explode or something but I can’t quite piece together an elegant/working solution. Any help would be appreciated.

  • 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-04T11:24:41+00:00Added an answer on June 4, 2026 at 11:24 am

    If you replace the single quotes with double quotes, it can be parsed with json:

    import json
    
    s = "{'blah':1178,'blah':0,'blah':260,'blah':0,'needWrapper':{'NEED':'TEXTNEED','NEED':'TEXTNEED'}, 'blah':'blah'}"
    
    print json.loads(s.replace("'", '"'))
    # {u'blah': u'blah', u'needWrapper': {u'NEED': u'TEXTNEED'}}
    

    Now you can just access the objects.

    If the source is coming from php, it should be able to produce valid JSON with double quoted objects:
    http://www.php.net/manual/en/function.json-encode.php

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

Sidebar

Related Questions

So I have the following PHP string: $output = {playerId:1178,percentChange:0.1,averageDraftPosition:260,percentOwned:0.1,mostRecentNews:{news:Accardo was called up from
Suppose I have the following string in php: somedirectory/abc/morethings/[folder name] How can I parse
Let's assume I have the following file - template.php : <?php $string = 'Hello
I have the following string in PHP: <p> [#form id=1]</p> What is the pattern
I have following Template string in mysql which i fetch through php. $msg =
I'm trying to convert a timestamp string to Date in PHP. I have following
I have following code in php: $mode = $this->input->get('mode'); // may return string or
(in PHP) I have the following string: $string = '<!--:fr--><p>Mamá lorem ipsum dolor sit
i have used following code in my c# application string verification_url = @http://site.com/posttest.php?; string
I have the following string in php: $string = 'FEDCBA9876543210'; The string can be

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.