Q:

Extract array from JSON using sed and regex

I'm trying to write a script for comissioning embedded devices, they retrieve a JSON object from an API that contains an array of scripts that must be run to comission the device. 
{
  "status":"wait",
  "settings":{
    "serialNo": "123456",
    "macAddress":"ff:ff:ff:ff:ff:ff",
    "ipMode": "static|dhcp",
    "ipAddress": "192.168.0.1",
    "ipSubnet": "255.255.255.0",
    "ipGateway": "192.168.0.10",
    "ipDns": "192.168.0.10"
  },
  "scripts":[
    "https://www.google.co.uk/1",
    "https://www.google.co.uk/2",
    "https://www.google.co.uk/3"
  ]
}

As the devices run minimal linux installs with busybox I am using sed to "parse" the JSON and retrieve the values from the object. This works fine for single parameters such as 
mac=$(echo $reply | sed -ne 's/^.*"macAddress":"\([^"]*\)".*$/\1/p')
echo $mac
ff:ff:ff:ff:ff:ff

I try to use a similar regex to match the contents of the array between [ and ] but when I run it through sed it returns with nothing.
scripts=$(echo $reply | sed -ne 's/"scripts":\(\[[^\[\]]*\]\)/\1/p')
echo $scripts

What I would like it to result in is this:
echo $scripts
["https://www.google.co.uk/1","https://www.google.co.uk/2","https://www.google.co.uk/3"]

A:

With jq you can issue the following command:
jq -r '.scripts[]' the.json

If you want to put this into an array, use command substitution:
arr=( $(jq -r '.scripts[]'  a.json ) )

Now you can access the individual urls using:
echo "${arr[0]}"
echo "${arr[1]}"
echo "${arr[2]}"

