0

I have the following object data:

var response = {
    "response": {
        "numFound": 7945,
        "docs": [{
            "description": "target",
            "url": "target",
            "id": "269653",
            "score": 6.9186745
        },
        {
            "description": "Target Kent",
            "url": "Target_Kent",
            "id": "37275",
            "score": 4.3241715
        }]
    },
    "highlighting": {
        "269653": {
            "description": ["<em>target</em>"]
        },
        "37275": {
            "description": ["<em>Target</em> Kent"]
        }
    }
};

I can use response.response.docs[0].description to print out "target". But I don't know how to print out "<em>target</em>". Thanks.

2
  • Please clarify your question. You said you can get it to print "target" but you don't know how to print "target"? Commented Dec 23, 2010 at 4:36
  • Question is not clear enough to be solved please edit and make things bit clear Commented Dec 23, 2010 at 4:42

2 Answers 2

1
response.highlighting[269653].description[0]

Try it: http://jsfiddle.net/9QFAM/

Sign up to request clarification or add additional context in comments.

Comments

0

Assuming you need to keep the reference to docs[0] or whichever other object reference:

response.highlighting[response.response.docs[0].id].description[0]

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.