How to retrieve key and value from JSON object

Posted by I Like PHP on Stack Overflow See other posts from Stack Overflow or by I Like PHP
Published on 2010-05-28T06:59:44Z Indexed on 2010/05/28 7:31 UTC
Read the original article Hit count: 151

Filed under:
|

I have a JSON object in this format:

{
  "supplier": {
    "mov_10": "love actually",
    "mov_1": "fare"
  },
  "quantity": 20,
  "success": true,
  "length":2
}

Now I want to create a select box below using the supplier object (using both the keys and values), like this:

<select id="selectme">
    <option id="mov_10">love actually</option>
    <option  id="mov_1">fare</option>
</select>

So how do I create it? I just want to know how to reach mov_10 and mov_1 in the object. Sorry for my bad English, but please help me.

Thanks.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JSON