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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:09:20+00:00 2026-05-26T09:09:20+00:00

The question sounds weird I know. But its a weird question. Let me clarify.

  • 0

The question sounds weird I know. But its a weird question. Let me clarify.

Im using the facebook graph api. The feeds for my page are returned in JSON and i have this bit of JSON here:

"message": "A3Media Uk Website is fully up and running! Tell your friends, We can't make Beautiful Websites without clients!\n - Alex Morley-Finch",
"message_tags": {
    "116": [
        {
            "id": "514033508",
            "name": "Alex Morley-Finch",
            "offset": 116,
            "length": 17
        }
        ]
    }

So from my knowledge, there is an object called message_tags which contains and array of objects called 116, and index 0 of this array contains and object with the variables id, name, offset and length.

Now what i want to do is, obviously replace the text “Alex Morley-Finch” within the message variable with the tag "name": "Alex Morley-Finch". Then using the id, length and offset i can replace the text with a html link to that profile using the ID!

This all seem pretty simple, however, i obviously want my code to be dynamic so the code will work for ANY tag at ANY position.

The name of the object array "116" always matches the offset contained inside it.

The actual question:

How can I dynamically get the name of the object Array (in this case ‘116’)?

Because my code would be something like (pseudo code):

if message has tag
    get name of tag
    if message contains name of tag
        replace message name using offset and length with html link tag with href = facebook url / id
    end if
end if

This would leave me with my html representation of the “message”

The thing is i cant get the name of the message_tag because id have to do somthing like:

// data[index] represents the current message

var json = JSON.parse(XmlHttpResponse.responseText);
json.data[index].message_tags.116[0].name;

as we can see this is not dynamic. This code will ONLY work for this tag.

So how do i get the name without referencing 116? is it even possible?

i was thinking about trying iterating through 1, 2, 3, 4, 5 –> 116 but that would be very performance costly AND bad coding AND im not even sure if you can reference arrays through variable names… … …

Im really stumped.

Please Help!

Alex

  • 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-26T09:09:21+00:00Added an answer on May 26, 2026 at 9:09 am

    This will loop through all of the tags. You might want to add code to check it’s the one you want to change in case there are multiple tags.

    for (var tag in message_tags) {
        message_tags[tag].name = "...";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question sounds weird, but please, let me explain myself. I'm using
Yes, I know it sounds weird, but it doesn't, the question is why, and
My question sounds pretty weird, but my problem is that I don't know how
I know this question sounds very basic. But I can't find it using Google.
Sounds like a weird question, but say I have something like this: $.post( /myajax.php,
I know the question sounds silly, but consider this: I have an array of
Sounds like a stupid question, doesn't it? But the page on the Jettison project
I know it may sound like a weird question, but is there any .NET
I know this may sound like a weird question to ask but I would
My question sounds like a contradiction, but I don't know how else to refer

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.