JSON modifity


#1

Hello,

Why modifity this code :

import {Component, OnInit} from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {Http} from "@angular/http";
import 'rxjs';

/**
 * Generated class for the TodaysPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-todays',
  templateUrl: 'todays.html',
})
export class TodaysPage implements OnInit{

  tips:any;
  sheetName: string = 'standard_today';
  sheetID: string = '175XqnHhcOS8CVoBY08xMhaDO39VmauBEFKU9qeaHS3U';


  constructor(public navCtrl: NavController, public navParams: NavParams,private http:Http) {

  }


  ionViewWillEnter() {
    console.log('ionViewDidLoad TodaysPage');

  }

  ngOnInit(){
    console.log('https://script.google.com/macros/s/AKfycbygukdW3tt8sCPcFDlkMnMuNu9bH5fpt7bKV50p2bM/exec?id='+this.sheetID+'&sheet='+this.sheetName);
    this.http.get('https://script.google.com/macros/s/AKfycbygukdW3tt8sCPcFDlkMnMuNu9bH5fpt7bKV50p2bM/exec?id='+this.sheetID+'&sheet='+this.sheetName)
      .map(res => res.json()).subscribe(data => {
      this.tips = data.standard_today;
      console.log(this.tips);
    })
  }

}

to upload it from json via recent post?

looks like the answer after the query:



{`"standard_today": [{"DATE": "2017-10-19", "COUNTRY_LEAGUE": "Euro.L", "TIME": "18:00", "HOME_TEAM": "Zenit St.P" "AWAY_TEAM": "Rosenborg", "HOME_SCORE": "0", "AWAY_SCORE": "0", "ODD": "1.33", "TIP": "Zenit St.P: win", "Gotcha" yet "}, {" DATE ":" 2017-10-19 "," COUNTRY_LEAGUE ":" Euro.L "," TIME "," 18:00 "," HOME_TEAM "" Nice, "" vs. AWAY_TEAM ":" "", "COUNTRY_LEAGUE": "Euro.L", "TIME": "18:00", "HOME_TEAM": "Zorya", "AWAY_TEAM": "Hertha Berlin", "HOME_SCORE": "0", "AWAY_SCORE", "ODD": "1.21", "TIP": "Under 3.5", "Gotcha": "yet"}, {"DATE": "2017-10-19" "COUNTRY_LEAGUE": "Euro.L", "TIME": "18:00", "HOME_TEAM": "Ostersunds", "AWAY_TEAM": "Ath Bilbao", "HOME_SCORE": "0", "AWAY_SCORE": "0", "ODD": "1.38", "TIP": "Over 1.5", "Gotcha": "yet"}, "DATE": "2017-10-19", "COUNTRY_LEAGUE": "Euro. L "," TIME "," 18:00 "," HOME_TEAM ":" Marseille "," vs. AWAY_TEAM ":" Guimaraes "," HOME_SCORE ":" 0 "," AWAY_SCORE ":" 0 "," ODD ":" 1.37 "," TIP ":" Marseille: win "," Gotcha ":" yet "}, {" DATE ":" 2017-10-19 " "COUNTRY_LEAGUE": "Euro.L", "TIME", "18:00", "HOME_TEAM": "Konyaspor", "vs. AWAY_TEAM": "Salzburg", "HOME_SCORE": "0", "AWAY_SCORE": " 0 "," ODD ":" 1.30 "," TIP ":" Under 3.5 "," Gotcha ":" yet "}," DATE ":" 2017-10-19 "," COUNTRY_LEAGUE ":" Euro.L "," TIME "," 18:00 "," HOME_TEAM ":" Lugano "," vs. AWAY_TEAM ":" Plzen "," HOME_SCORE ":" 0 "," AWAY_SCORE ":" 0 "," ODD ":" 1.29 "TIP": "Over 1.5", "Gotcha": "yet"}, "" DATE ":" 2017-10-19 "," COUNTRY_LEAGUE ":" Euro.L "," TIME ":" 05 "," HOME_TEAM ":" Zlin "," AWAY_TEAM ":" FC Copenhagen "," HOME_SCORE ":" 0 "," AWAY_SCORE ":" 0 "," ODD " "win or draw", "gotcha": "yet"}, "DATE": "2017-10-19", "COUNTRY_LEAGUE": "Euro.L", "TIME": "20:05", "HOME_TEAM "AC Milan", "AWAY_TEAM": "AEK Athens", "HOME_SCORE": "0", "AWAY_SCORE": "0", "ODD" "Gotcha", "yet"}, { "DATE", "2017-10-19", "COUNTRY_LEAGUE" "Euro.L", "TIME", "20:05", "HOME_TEAM" "Dyn. Kiev "," AWAY_TEAM ":" Young Boys "," HOME_SCORE ":" 0 "," AWAY_SCORE ":" 0 "," ODD ":" 1.23 "," TIP " "", "COUNTRY_LEAGUE": "Euro.L", "TIME": "20:05", "HOME_TEAM": "Villarreal", "AWAY_TEAM": " HOME "," HOME_SCORE ":" 0 "," AWAY_SCORE ":" 0 "," ODD ":" 1.35 "," TIP " "COUNTRY_LEAGUE": "Euro.L", "TIME": "20:05", "HOME_TEAM": "Austria Vienna", "AWAY_TEAM": "HNK Rijeka", "HOME_SCORE" : "0", "AWAY_SCORE": "0", "ODD": "1.33", "TIP": "Over 1.5", "Gotcha": "yet"}, "DATE": "2017-10-19 "" COUNTRY_LEAGUE ":" Euro.L "," TIME "," 20:05 "," HOME_TEAM ":" Everton "," vs. AWAY_TEAM ":" Lyon "," HOME_SCORE ":" 0 "," AWAY_SCORE ": "0", "ODD": "1.45", "TIP": "Everton: win or draw", "Gotcha": "yet"}}}`

So the server response from which I want to download custom fields

{"status":"ok","count":2,"count_total":2,"pages":0,"posts":[{"id":4976,"type":"standard_today","slug":"new1","url":"https:\/\/example.pl\/standard_today\/new1\/","status":"publish","title":"NEW1","title_plain":"NEW1","content":"","excerpt":"","date":"2017-10-19 08:28:03","modified":"2017-10-19 08:28:03","categories":[],"tags":[],"author":{"id":1,"slug":"admin","name":"admin","first_name":"","last_name":"","nickname":"admin","url":"","description":""},"comments":[],"attachments":[],"comment_count":0,"comment_status":"closed","custom_fields":{"TIME":["14:00:00"],"DATE":["20171020"],"COUNTRY_LEAGUE":["FIFA"],"HOME_TEAM":["Polska"],"AWAY_TEAM":["Hiszpania"],"HOME_SCORE":["11"],"AWAY_SCORE":["1"],"ODD":["5"],"TIP":["Over 5"],"slide_template":["default"]}},{"id":4959,"type":"standard_today","slug":"new","url":"https:\/\/exampe.pll\/standard_today\/new\/","status":"publish","title":"NEW","title_plain":"NEW","content":"","excerpt":"","date":"2017-10-18 07:14:34","modified":"2017-10-18 07:14:34","categories":[],"tags":[],"author":{"id":1,"slug":"admin","name":"admin","first_name":"","last_name":"","nickname":"admin","url":"","description":""},"comments":[],"attachments":[],"comment_count":0,"comment_status":"closed","custom_fields":{"TIME":["15:00:00"],"DATE":["20171019"],"COUNTRY_LEAGUE":["FIFA"],"HOME_TEAM":["Barcelona"],"AWAY_TEAM":["Real Madryt"],"HOME_SCORE":["3"],"AWAY_SCORE":["1"],"ODD":["3"],"TIP":["Over 3,5"],"slide_template":["default"]}}],"query":{"ignore_sticky_posts":true,"post_type":"standard_today","posts_per_page":"-1"}}