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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:11:42+00:00 2026-06-17T16:11:42+00:00

Uh hmm how can I word this. Lets start of with an example of

  • 0

Uh hmm how can I word this. Lets start of with an example of my object:

"data": {
    "events": [
        {
            "event_id": 12345,
            "event_ts_begin": 1358931738000,
            "event_ts_end": 1358931748000,
            "event_severity": "minor",
            "event_code": 23,
            "event_desc": "Completed",
            "event_type": "normal",
            "event_text": "Completed, blah on blah blah blah..."
        },
        {
            "event_id": 12346,
            "event_ts_begin": 1358931738000,
            "event_ts_end": 1358931748000,
            "event_severity": "minor",
            "event_code": 23,
            "event_desc": "Completed",
            "event_type": "normal",
            "event_text": "Completed, blah on blah blah blah..."
        },
        {
            "event_id": 12347,
            "event_ts_begin": 1358931738000,
            "event_ts_end": 1358931748000,
            "event_severity": "minor",
            "event_code": 23,
            "event_desc": "Completed",
            "event_type": "normal",
            "event_text": "Completed, blah on blah blah blah..."
        }
    ]
}

What I want to do is some how find out where event_id 12346 is in this multidimensional object and use that particular data set as an object by itself. Somehow taking it out and defining a temporary variable as that object so it would be equal to:

var tempObj = {
            "event_id": 12346,
            "event_ts_begin": 1358931738000,
            "event_ts_end": 1358931748000,
            "event_severity": "minor",
            "event_code": 23,
            "event_desc": "Completed",
            "event_type": "normal",
            "event_text": "Completed, blah on blah blah blah..."
        };

The sample object above with the multiple objects in it, can be 1,000+ objects or more in some cases. So looping over them and rebuilding an option doesn’t sound like a great idea. So I am hoping I can get some feedback to come up with a sane solution.

Is there a way I can find the particular index number of that particular object to use it as a means of defining the temp var?

  • 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-17T16:11:43+00:00Added an answer on June 17, 2026 at 4:11 pm

    You can use jQuery.grep function to find elements in array.

    var tmpObj = $.grep(data.events, function(obj){
        return obj.event_id == '12347'
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hmm well there's lots here about this but I can't seem to get a
Hmm.. can't figure this one out. I'm new to Vim and I believe it
Hmm..can't yet read this yet..but does Ruby Array#assoc use linear search? rb_ary_assoc(VALUE ary, VALUE
Hmm.. thats realy different problem I fetch $links from db linke this $links =
Hmm...this question may sounds silly , hope you all don't mind... If I have
is there a way that I can make this work? Or do I need
Hmm not sure if the title of this makes any sense. I'm creating a
Hmm I can't really indentify any insecurities but was wondering whether you can, if
I tried to create a data context in EF5 RC similar to this: class
Hmm the only point I can think of is that it gives less re

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.