-2

I have below JSON values, How can i get the values one by one using keys like id, trade pair using jQuery

[Object {
  id = "1", trade_pair = "BTC/ETH", to_symbol_id = "1"
}, Object {
  id = "2", trade_pair = "BTC/BCH", to_symbol_id = "1"
}, Object {
  id = "3", trade_pair = "BTC/USDT", to_symbol_id = "1"
}, Object {
  id = "4", trade_pair = "BTC/LTC", to_symbol_id = "1"
}, Object {
  id = "5", trade_pair = "BTC/BTG", to_symbol_id = "1"
}, Object {
  id = "6", trade_pair = "BTC/XRP", to_symbol_id = "1"
}, Object {
  id = "7", trade_pair = "BTC/DASH", to_symbol_id = "1"
}, Object {
  id = "8", trade_pair = "BTC/XMR", to_symbol_id = "1"
}, Object {
  id = "9", trade_pair = "BTC/ETC", to_symbol_id = "1"
}, Object {
  id = "10", trade_pair = "BTC/DGB", to_symbol_id = "1",
}, Object {
  id = "11", trade_pair = "BTC/BCC", to_symbol_id = "1",
}]
Sankar
  • 6,908
  • 2
  • 30
  • 53
  • `forEach` loop? – Adelin Jan 31 '18 at 07:49
  • Can you please add more description for that. – Hardik Jan 31 '18 at 07:50
  • 1
    Possible duplicate of [How do I loop through or enumerate a JavaScript object?](https://stackoverflow.com/questions/684672/how-do-i-loop-through-or-enumerate-a-javascript-object) – cнŝdk Jan 31 '18 at 07:50
  • You have an array of objects. Loop through your array, and then examine each object. Not hard to do so. Please be aware that StackOverflow is not a coding service. For further reference, please read the [how to ask](https://stackoverflow.com/help/how-to-ask) guide – KarelG Jan 31 '18 at 07:51

1 Answers1

1

I think your question related to javascript not jquery, if I understand correctliy. You can use Object.Keys.

var myObject = { id : 1, name : "Test" }

Object.keys(myObject).forEach(function(key){
  console.log("key", key);
  console.log("value", myObject[key])
})