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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:13:20+00:00 2026-06-02T17:13:20+00:00

I saw this answer dealing with getting data from JSON. I’m trying to do

  • 0

I saw this answer dealing with getting data from JSON. I’m trying to do almost the same, but my JSON is structured differently as far as arrays/objects and I’m not sure how to parse it the same way.

My JSON is in this format and I’m trying to write a function to find certain elements based on the linked question, but without keys for the elements in the json, not sure how to target things. Or do I need to try and rework the out put of my json? (which is being created by json_encode from a modified codeigniter db query.

$(function() {
var json = [
  {

    "answer": [

      "4555"

    ],
    "answer_string": "4555|",
    "qid": "70",
    "aid": "742"
  }, 
 {

    "answer": [

      "monkeys",
      "badgers",
      "monkeybadgers"

    ],
    "answer_string": "monkeys|badgers|monkeybadgers|",
    "qid": "71",
    "aid": "742"
  }
];
    $.each(json[], function(i, v) {
        if (v.qid= "70") {
            alert(v.answer[0]);
            return;
        }
    });
});​

jsfiddle

I need to find answer[0] where qid matches a certain number.

  • 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-02T17:13:21+00:00Added an answer on June 2, 2026 at 5:13 pm

    Your javascript is messed up. See updated fiddle:

    http://jsfiddle.net/jQmyf/2/

    Specifically: if (v.qid= "70") { that should be v.qid==

    and $.each(json[] should just be $.each(json

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

Sidebar

Related Questions

I saw this thread here but didnt get any answer to my thoughts. for
I saw this answer to a similar question , but it always scares me
I saw this answer that was given two years ago, but all I'm seeing
I saw this post on SO: UISearchBar solid color But no answer was provided.
I saw this question already, but I didnt see an answer.. So I get
I saw this question, but I didn't find my answer in it.. So, why
Saw this questions asked many times. But couldn't find a reasonable answer. What is
I am 90% sure I saw this answer on stackoverflow before, in fact I
I saw this in an answer to another question , in reference to shortcomings
I saw this in a answer by Marc Gravell, and I just don't see

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.