You are in essence going to have to write a bash script at some point because the command will bloat beyond what can be sanely contained in a JSON property.
or do it in python like I did - http://kopy.io/yvEGl it works amazingly and gives you endless flexibility without require bash.
Comments
or do it in python like I did - http://kopy.io/yvEGl it works amazingly and gives you endless flexibility without require bash.