Good evening! I am creating a component in Angular, to which I pass a text in a certain format and convert it to JSON format. So far so good. The point is that now I want to press a button, I downloaded the previously created object as a JSON file, and as much as I looked I can not find the form. Here I leave the part of the TS code where I create the object in JSON format:
> onSubmit(){
> this.stats = this.FIFAstatsform.get('fifastats').value;
> this.stats = this.stats.replace(/\n/g, " ");
> this.statsplitted = this.stats.split(" ", 58);
> this.jsonobject = '{';
> for (let stat of this.statsplitted){
> if (this.statsplitted.indexOf(stat)%2==0){
> this.jsonobject=this.jsonobject+'"'+stat+'"'+':';
> }
> if (this.statsplitted.indexOf(stat)%2!=0 && this.statsplitted.length-1 != this.statsplitted.indexOf(stat)){
> this.jsonobject=this.jsonobject+stat+',';
> }
> if (this.statsplitted.indexOf(stat)%2!=0 && this.statsplitted.length-1 == this.statsplitted.indexOf(stat)){
> this.jsonobject=this.jsonobject+stat+'}';
> }
> }
> this.creado = true;