Skip to main content
I added some information to the post in response to edits made.
Source Link
JpaytonWPD
  • 698
  • 1
  • 6
  • 18

I have a JSON output that contains a list of objects stored in a variable. (I may not be phrasing that right)

[
  {
    "item1": "value1",
    "item2": "value2",
    "sub items": [
      {
        "subitem": "subvalue"
      }
    ]
  },
  {
    "item1": "value1_2",
    "item2": "value2_2",
    "sub items_2": [
      {
        "subitem_2": "subvalue_2"
      }
    ]
  }
]

I need all the values for item2 in a array for a bash script to be run on ubuntu 14.04.1.

I have found a bunch of ways to get the entire result into an array but not just the items I need

I have a JSON output that contains a list of objects. (I may not be phrasing that right)

[
  {
    "item1": "value1",
    "item2": "value2",
    "sub items": [
      {
        "subitem": "subvalue"
      }
    ]
  },
  {
    "item1": "value1_2",
    "item2": "value2_2",
    "sub items_2": [
      {
        "subitem_2": "subvalue_2"
      }
    ]
  }
]

I need all the values for item2 in a array for a bash script.

I have found a bunch of ways to get the entire result into an array but not just the items I need

I have a JSON output that contains a list of objects stored in a variable. (I may not be phrasing that right)

[
  {
    "item1": "value1",
    "item2": "value2",
    "sub items": [
      {
        "subitem": "subvalue"
      }
    ]
  },
  {
    "item1": "value1_2",
    "item2": "value2_2",
    "sub items_2": [
      {
        "subitem_2": "subvalue_2"
      }
    ]
  }
]

I need all the values for item2 in a array for a bash script to be run on ubuntu 14.04.1.

I have found a bunch of ways to get the entire result into an array but not just the items I need

added 67 characters in body
Source Link
Gilles Quénot
  • 36.7k
  • 7
  • 74
  • 97

I have a JSON output that contains a list of objects. (I may not be phrasing that right)

[
  {
    "item1" : "value1",
    "item2" : "value2",
    "sub items" : [
      {
  "subitem"      "subitem": "subvalue"
      }
    ]
  },
  {
    "item1" : "value1_2",
    "item2" : "value2_2",
    "sub items_2" : [
      {
  "subitem_2"      "subitem_2": "subvalue_2"
      }
    ]
  }
]

I need all the values for item2 in a array for a bash script.

I have found a bunch of ways to get the entire result into an array but not just the items I need

I have a JSON output that contains a list of objects. (I may not be phrasing that right)

{
    "item1" : "value1",
    "item2" : "value2",
    "sub items" : [
        "subitem" : "subvalue"
    ]
}
{
    "item1" : "value1_2",
    "item2" : "value2_2",
    "sub items_2" : [
        "subitem_2" : "subvalue_2"
    ]
}

I need all the values for item2 in a array for a bash script.

I have found a bunch of ways to get the entire result into an array but not just the items I need

I have a JSON output that contains a list of objects. (I may not be phrasing that right)

[
  {
    "item1": "value1",
    "item2": "value2",
    "sub items": [
      {
        "subitem": "subvalue"
      }
    ]
  },
  {
    "item1": "value1_2",
    "item2": "value2_2",
    "sub items_2": [
      {
        "subitem_2": "subvalue_2"
      }
    ]
  }
]

I need all the values for item2 in a array for a bash script.

I have found a bunch of ways to get the entire result into an array but not just the items I need

Forgot a quote in my example
Source Link
JpaytonWPD
  • 698
  • 1
  • 6
  • 18

I have a JSON output that contains a list of objects. (I may not be phrasing that right)

{
    "item1" : "value1",
    "item2" : "value2",
    "sub items" : [
        "subitem" : "subvalue"subvalue"
    ]
}
{
    "item1" : "value1_2",
    "item2" : "value2_2",
    "sub items_2" : [
        "subitem_2" : "subvalue_2"
    ]
}

I need all the values for item2 in a array for a bash script.

I have found a bunch of ways to get the entire result into an array but not just the items I need

I have a JSON output that contains a list of objects. (I may not be phrasing that right)

{
    "item1" : "value1",
    "item2" : "value2",
    "sub items" : [
        "subitem" : "subvalue
    ]
}
{
    "item1" : "value1_2",
    "item2" : "value2_2",
    "sub items_2" : [
        "subitem_2" : "subvalue_2"
    ]
}

I need all the values for item2 in a array for a bash script.

I have found a bunch of ways to get the entire result into an array but not just the items I need

I have a JSON output that contains a list of objects. (I may not be phrasing that right)

{
    "item1" : "value1",
    "item2" : "value2",
    "sub items" : [
        "subitem" : "subvalue"
    ]
}
{
    "item1" : "value1_2",
    "item2" : "value2_2",
    "sub items_2" : [
        "subitem_2" : "subvalue_2"
    ]
}

I need all the values for item2 in a array for a bash script.

I have found a bunch of ways to get the entire result into an array but not just the items I need

edited tags
Link
Gilles 'SO- stop being evil'
  • 865.3k
  • 205
  • 1.8k
  • 2.3k
Loading
Source Link
JpaytonWPD
  • 698
  • 1
  • 6
  • 18
Loading