0

I have approx 6k urls to put into a .json list in my iOS app

 [{
  "trigger": {
    "url-filter": "somepage1.com",
    "load-type" : ["third-party"]
  },
  "action": {
    "type": "doSoemthing"
  }
}, {
  "trigger": {
    "url-filter": "somepage2.com",
    "load-type" : ["third-party"]
  },
  "action": {
    "type": "doSoemthing"
  }
}, {
  "trigger": {
    "url-filter": "anotherpage.net",
    "load-type" : ["third-party"]
  },
  "action": {
    "type": "doSoemthing"
  }
}, {
  "trigger": {
    "url-filter": "yetanotherone.net", <---replace with another 6k 
    "load-type" : ["third-party"]
  },
  "action": {
    "type": "doSoemthing"
  }]

  ...etc

Im after an efficient way to automate this (efficient for entering data manually rather than cpu processing efficiency). Not having really done anything but very basic json before, i'm wondering if there is a way I can make an array in my .json.class and interpole all the urls?

Or

Perhaps using textwrangler. I realise this wouldn't work in Text Wrangler "as is", this is just to illustrate what I would like to achieve

enter image description here

The individual urls are in raw text format list

JSA986
  • 5,870
  • 9
  • 45
  • 91
  • Do you have that url's in array ? What is the structure of that ? How did you get those ? – Midhun MP Nov 02 '15 at 13:02
  • The urls at the moment are just raw data in a huge list in text wrangler – JSA986 Nov 02 '15 at 13:03
  • With **grep** enabled, you could have searched for `^(.+)$` and replaced with `, {\n "trigger": {\n "url-filter": "\1",\n "load-type" : ["third-party"]\n },\n "action": {\n "type": "doSoemthing"\n }]` – Abecee Apr 12 '17 at 20:09

0 Answers0