JSON API code change - Help!

JSON API code change - Help!
0

#1

Hi,

Hope everyone is well and that there is somebody out there that can help me…

I am just new to JSON coding to access our data through an API - i have tried to alter the code myself but have had no joy…

Using the guidance documents available and the help supplied online for the API portal I can extract the data (yeah !!) but the issue i have is it combines all the TIMES together but i need them reported separately - can anyone advise how to structure the code please? ( snapshot of time sets codes attached)

Many thanks

image


#2

Can you supply the actual code you are using to extra the data, so we can see what is causing the combination of the times? How exactly are you trying to display them?


#3

Hi Rabdelldawson,

thanks for your response - full code text shown below ( im not sure if there is a way to attached a text file).

{
  "jobName":"5357 - M61 M6",
  "distanceUnit":"KILOMETERS",
  "network": {
    "name": "M61 M6 CAA",
    "boundingBox" : {
      "leftDownCorner": {
        "longitude":-2.514241,
        "latitude":53.5359
      },
      "rightTopCorner": {
        "longitude":-2.387367,
        "latitude":53.5632
      }
    },
    "timeZoneId": "GMT",
    "frcs": [
      "0",
      "2",
      "3"
    ],
    "probeSource":"ALL"
 },
  "dateRange": {
    "name":"2014 to 2015",
    "from":"2014-03-04",
    "to":"2015-09-24",
    "exclusions":[
    	"2014-03-16",
    	"2014-03-23",
    	"2014-03-30",
    	"2014-04-06",
    	"2014-04-13",
    	"2014-04-20",
    	"2014-04-27",
    	"2014-05-04",
    	"2014-05-11",
    	"2014-05-18",
    	"2014-05-25",
    	"2014-06-01",
    	"2014-06-08",
    	"2014-06-15",
    	"2014-06-22",
    	"2014-06-29",
    	"2014-07-06",
    	"2014-07-13",
    	"2014-07-20",
    	"2014-07-27",
    	"2014-08-03",
    	"2014-08-10",
    	"2014-08-17",
    	"2014-08-24",
    	"2014-08-31",
    	"2014-09-07",
    	"2014-09-14",
    	"2014-09-21",
    	"2014-09-28",
    	"2014-10-05",
      "2014-10-12",
      "2014-10-19"
    ]
  },
  "timeSets":[
    {
      "name":"AM_INTER_PM",
      "timeGroups":[
        {
          "days":[
          	"MON",
          	"TUE",
          	"WED",
          	"THU",
          	"FRI",
          	"SAT",
            "SUN"
          ],
          "times":[
          	"7:00-8:00",
          	"8:00-9:00",
          	"9:00-10:00",
          	"11:00-14:00",
          	"16:00-17:00",
          	"17:00-18:00",
            "18:00-19:00"
          ]
        }
      ]
    }
  ]
}

#4

You have post the JSON object, but not the code you are trying to use to access the times. The times are in an array. You should have already learned how to access array elements. You stated “it combines all the TIMES together”. I assumed you had written code already which was displaying the times all together.

FYI - I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.