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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:49:09+00:00 2026-05-16T22:49:09+00:00

I have the following text below, what is the easiest way to parse through

  • 0

I have the following text below, what is the easiest way to parse through it?

if(typeof sa_inst.apiCB == 'function') sa_inst.apiCB({"AS":{"Query":"g","FullResults":1,"Results":[{"Type":"AS","Suggests":[{"Txt":"g<strong>oogle</strong>","Type":"AS","Sk":""},{"Txt":"g<strong>mail</strong>","Type":"AS","Sk":"AS1"},{"Txt":"g<strong>oogle</strong> <strong>maps</strong>","Type":"AS","Sk":"AS2"},{"Txt":"g<strong>oogle</strong> <strong>earth</strong>","Type":"AS","Sk":"AS3"},{"Txt":"g<strong>ames</strong>","Type":"AS","Sk":"AS4"},{"Txt":"g<strong>oogle</strong> <strong>images</strong>","Type":"AS","Sk":"AS5"},{"Txt":"g<strong>amestop</strong>","Type":"AS","Sk":"AS6"},{"Txt":"g<strong>rainger</strong>","Type":"AS","Sk":"AS7"}]}]}} /* pageview_candidate */);

I would like to only get what is after (“Txt”:) and not including the <strong> or anything else. For example, form the text above I would like to get something like:

google, gmail, google maps, google images, etc

in an array. Help please?

  • 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-16T22:49:10+00:00Added an answer on May 16, 2026 at 10:49 pm

    The text is JSON. Use json_decode to parse it.

    $str = '{"AS":{"Query":"g","FullResults":1,"Results":[{"Type":"AS","Suggests":[{"Txt":"g<strong>oogle</strong>","Type":"AS","Sk":""},{"Txt":"g<strong>mail</strong>","Type":"AS","Sk":"AS1"},{"Txt":"g<strong>oogle</strong> <strong>maps</strong>","Type":"AS","Sk":"AS2"},{"Txt":"g<strong>oogle</strong> <strong>earth</strong>","Type":"AS","Sk":"AS3"},{"Txt":"g<strong>ames</strong>","Type":"AS","Sk":"AS4"},{"Txt":"g<strong>oogle</strong> <strong>images</strong>","Type":"AS","Sk":"AS5"},{"Txt":"g<strong>amestop</strong>","Type":"AS","Sk":"AS6"},{"Txt":"g<strong>rainger</strong>","Type":"AS","Sk":"AS7"}]}]}}';
    
    $result = json_decode($str);
    
    //Show all 'Txt' values
    foreach($result->AS->Results[0]->Suggests as $suggests)
    echo "Txt contains: ".htmlspecialchars($suggests->Txt). "<br/>";
    
    //Show full contents of result
    echo "<pre>";
    print_r($result);
    

    This outputs values of Txt first:

    Txt contains: g<strong>mail</strong>  
    Txt contains: g<strong>oogle</strong> <strong>maps</strong>  
    Txt contains: g<strong>oogle</strong> <strong>earth</strong>  
    Txt contains: g<strong>ames</strong>  
    Txt contains: g<strong>oogle</strong> <strong>images</strong>  
    Txt contains: g<strong>amestop</strong>  
    Txt contains: g<strong>rainger</strong>  
    

    And then the complete JSON data too:

    stdClass Object
    (
        [AS] => stdClass Object
            (
                [Query] => g
                [FullResults] => 1
                [Results] => Array
                    (
                        [0] => stdClass Object
                            (
                                [Type] => AS
                                [Suggests] => Array
                                    (
                                        [0] => stdClass Object
                                            (
                                                [Txt] => google
                                                [Type] => AS
                                                [Sk] => 
                                            )
    
                                        [1] => stdClass Object
                                            (
                                                [Txt] => gmail
                                                [Type] => AS
                                                [Sk] => AS1
                                            )
    
                                        [2] => stdClass Object
                                            (
                                                [Txt] => google maps
                                                [Type] => AS
                                                [Sk] => AS2
                                            )
    
                                        [3] => stdClass Object
                                            (
                                                [Txt] => google earth
                                                [Type] => AS
                                                [Sk] => AS3
                                            )
    
                                        [4] => stdClass Object
                                            (
                                                [Txt] => games
                                                [Type] => AS
                                                [Sk] => AS4
                                            )
    
                                        [5] => stdClass Object
                                            (
                                                [Txt] => google images
                                                [Type] => AS
                                                [Sk] => AS5
                                            )
    
                                        [6] => stdClass Object
                                            (
                                                [Txt] => gamestop
                                                [Type] => AS
                                                [Sk] => AS6
                                            )
    
                                        [7] => stdClass Object
                                            (
                                                [Txt] => grainger
                                                [Type] => AS
                                                [Sk] => AS7
                                            )
    
                                    )
    
                            )
    
                    )
    
            )
    
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following validation code for a text field but the 'field' below
I have the following JSON text to parse in Java: { items: [ {
i have the following javascript below after i finish an ajax query all of
I have the following function below that will normally spit out a URL such
I have following text in my file Index: D:/QATV2Demo/Main.msbuild =================================================================== --- D:/QATV2Demo/Main.msbuild (revision 12414)
I have the following text in xml file: <Config Builder=LP Wizard> <Libraries> <Library Name=XCAMSource/>
I have the following text, I need to extract the exception name and the
I have the following text: started: Project: ProjectA, Configuration: Release Any CPU ------ I
I have the following text: We%27re%20proud%20to%20introduce%20the%20Amazing I'd like to remove the encoding using PHP,
I have the following text, I need to extract the exception name and the

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.