How to get the position data from the joystick to the flask server?

I would like to get the position data from the js joystick o use it at the flask server. I tried using ajax:

python:

@app.route(‘/test’, methods=[‘GET’, ‘POST’])
def test_ajax():

    if request.method == "POST":
        data = request.json
        print('data:', data)
        result = {'url': url_for('index')}
        print('result:', result)
        return jsonify(result)
    else:
        return render_template('index.html')

<div class="container fluid">
    
            <h1>Joystick</h1>
            
            <div id="joy1Div" style="width:200px;height:200px;margin-bottom:20px;"></div>
    
        </div>
        
        <script type="text/javascript">
                   
          var Joy1 = new JoyStick('joy1Div', {}, function(stickData) {
          joy1IinputPosX.value = stickData.xPosition;
          joy1InputPosY.value = stickData.yPosition;
          joy1Direzione.value = stickData.cardinalDirection;
          joy1X.value = stickData.x;
          joy1Y.value = stickData.y;
          });
            
        </script>
    
        <script>
    
          data = {'ID': 'foobar'};
          var joystick = document.getElementById('joy1Div');
          joy1X.onchange = function() {
            $.ajax({
              type: "POST",
              url: "/test",
              contentType: 'application/json;charset=UTF-8',
              data: JSON.stringify(data, null, 't'),
              dataType: 'json',
              success: function(data) {
                  window.location.href = data['url']
              },
              error: function(response) {
                  alert(response)
              },
          });
          }; 
    
        </script> 

Every time the position of the joystick changed I would like to send the position data to flask

Remove Klarna Payments with cash on delivery method

I have a problem with a code. So I have five different payment methods in my site. When a customer select “Cash on delivery” as shipment method all the payment methods, exept cash on delivery, are hide.
For make that I use the follow code:

/**
* Remove payment methods when select "pagamento in contrassegno"
*/
function my_custom_available_payment_gateways( $gateways ) {

$chosen_shipping_rates = WC()->session->get( 'chosen_shipping_methods' );

// When 'Pagamento in contrassegno' has been chosen as shipping rate
if ( in_array( 'flat_rate:5', $chosen_shipping_rates ) ) :

    // Remove the follow payments
    unset( $gateways['woocommerce_payments'] );
    unset( $gateways['paypal'] );
    unset( $gateways['bacs'] );
    unset( $gateways['klarna_payments_pay_later'] );

    endif;

    return $gateways;

    }
    add_filter( 'woocommerce_available_payment_gateways', 
    'my_custom_available_payment_gateways' );

The code work with all payments exept for Klarna payments that remain if I select “Pagamento in contrassegno” (cash on delivery), how can I solve that?

The site is: https://www.modacapellishop.it/

Electron ignores setThumbarButtons([])

I just started to learn about electron. I want to create a window without the Thumbar Buttons, but electron ignores the .setThumbarButtons call
This is my main.js from a tutorial:


const electron = require('electron')
// Module to control application life.
const app = electron.app
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow

const path = require('path')
const url = require('url')

let mainWindow

function createWindow () {
 
  mainWindow = new BrowserWindow({width: 800, height: 600})
  mainWindow.setThumbarButtons([])

  mainWindow.loadURL(url.format({
    pathname: path.join(__dirname, 'index.html'),
    protocol: 'file:',
    slashes: true
  }))


 
app.on('activate', function () {
 
  if (mainWindow === null) {
    createWindow()
    mainWindow.setThumbarButtons([])
  }
})

provide leaflet-map to react-component

I’m using react-leaflet to render a map. I created a component that has a map-property:

import * as React from 'react';
import { Map, FeatureCollection } from  'leaflet';

class Car extends React.Component {
    
    state = { 
        map: Map,
        collection: FeatureCollection
    }
    constructor(props) {
        super(props);
        this.state = { 
            map: props.map,
            collection: props.collection
        }
    }

Now I try to use that component within my app:

import React, { useState } from 'react';
import { MapContainer, useMap } from 'react-leaflet';
import Car from './Car';

function Layout() {

    return (
        <div>
            <MapContainer bounds={[[52.475,13.3], [52.477,13.5]]} zoom={12}>
                <Car map={ useMap() }/>
            </MapContainer> 
        </div>
    )
}

export default Layout;

However I don’t know how to provide the map from the MapContainer into my Car-component. Using the above code I get the following error:

TS2322: Type ‘{ map: string; }’ is not assignable to type ‘IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{}> & Readonly<{ children?: ReactNode; }>’.
Property ‘map’ does not exist on type ‘IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{}> & Readonly<{ children?: ReactNode; }>’.

Is there a solution to restore minified with source map?

My goal is to restore minified names to original

I’ve tested a lot of tools such as:
https://github.com/denandz/sourcemapper – Error “No source content found.”
https://github.com/paazmaya/shuji Error like “Source can’t be restored”

And some others, non of them are working. I am not to much familiar with map structure, but I guess they are looking for sourcesContent which is empty or?

js file: https://drive.google.com/file/d/1NIqnIo125At7lTQ8lZwiCEHi3HDJq3vc/view?usp=sharing
map file: https://drive.google.com/file/d/1kDikCUXkXtgznG6TGKAjAtgEvoqq-EGJ/view?usp=sharing

addeventlistener in javascript breaks when I replace jQuery with vanilla javascript to copy a html template

I am trying to get rid of jQuery from my code and for some reason, this jQuery works “$(“#modal-body”).html(post_template);” but when I convert to pure vanilla JavaScript “document.getElementById(‘modal-body’).innerHTML=post_template.outerHTML” the html looks fine, but it breaks a function below that is called by “post_template.addEventListener(‘submit’, async (e) =>”.

Here is the function I am trying to rid of jQuery. I commented out the piece that makes it work with jQuery.

function build_post_modal() {
    post_template=document.getElementById('post_template')

    document.getElementById('modal-title').innerHTML='Post'

    //For some reason this code breaks the addEventListener code below
    document.getElementById('modal-body').innerHTML=post_template.outerHTML
    //This code does what I want, but uses jQuery
    //$("#modal-body").html(post_template);

    footer="<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>"
    document.getElementById('modal-footer').innerHTML=footer
    //Push template back to DOM on close
    $('#siteModal').on('hide.bs.modal', function (e) {
        $("#post_modal").html(post_template);
        //TODO get typed context to push back to main window
    })

    const fields = {
        csrf_token: {
            input: document.getElementById('csrf_token'),
            error: document.getElementById('csrf_token-error')
        },
        body: {
            input: document.getElementById('body'),
            error: document.getElementById('body-error')
        }
    }
    //This code breaks when I use the pure javascript method for making the modal-body
    post_template.addEventListener('submit', async (e) => {
        e.preventDefault();
        const response = await fetch('/_submit_post', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({
                csrf_token: fields.csrf_token.input.value,
                body: fields.body.input.value
            })
        });
        if (response.ok) {
            $('#siteModal').modal('hide')
            jFlash(await response.text())
        } else {
            const errors = await response.json();
            Object.keys(errors).forEach((key) => {
               fields[key].input.classList.add('is-invalid');
               fields[key].error.innerHTML = errors[key][0];
            });
        }
    });

};

This is the jinja html that I am trying to pull the template from to style a modal.

<a data-bs-toggle="modal" data-bs-target="#siteModal" onclick="build_post_modal()">
    <div class="post d-flex align-items-center">
        <img src="{{ current_user.avatar(50) }}" width="50" class="rounded-circle mr-2">
        <input class="form-control" id="post_body" placeholder="Make a post..." type="text" value="">
    </div>
</a>
<div id="post_modal" style="display: none;">
    <form id="post_template" method="POST">
        {{ form.csrf_token }}
        <div class="text-danger my-2" id="csrf_token-error"></div>
        <div class="post d-flex align-items-center">
            <img src="{{ current_user.avatar(50) }}" width="50" class="rounded-circle mr-2">
            <div class="form-group">
                {{ form.body.label }}
                {{ form.body(class='form-control', placeholder='Make a post...') }}
                <div id="body-error" class="invalid-feedback"></div>
            </div>
        </div>
    </form>
</div>

converting gpx/kml to geojson for large files

I’m working on an arcgis project where users can uplaod gpx/kml to the server and can be viewed in the map, I was able to do it. Unfortunately, there is a specific case where converting the gpx/kml file to togeojson will crash the app if the gpx/kml file is too large. i.e. 5mb+. I’m using 3rd party library (togeojson converter) which can be found here: https://www.npmjs.com/package/@mapbox/togeojson.
1

TL,DR: Does anyone know how to convert gpx/kml to geoJSON for large files (5mb and above)?

Random misplacement of a div

I’m making a website for myself and it has a projects page and I made a js script to auto add each of the projects using a json file. I have 4 projects in the json file so far but one of them is acting up. Image here

Circled in red is the div that is messed up.
Here is the css for those divs:

#img {
vertical-align: top;
display: inline-block;
border-radius: 10px 10px 0px 0px;
width: 340px;
}
#title {
    margin-top: 40px;
    vertical-align: top;
    font-weight: bold;
    font-size: 30px;
    float: left;
    margin-left: 5px;
    display: inline-block;
}
#desc {
    float: left;
    margin-left: 5px;
    display: inline-block;
}

Now here is the js script that is adding them:

$.getJSON('https://raw.githubusercontent.com/Pinball3D/andysthings/main/registy.json', 
function(data){
  console.log(data);
  var i = 0;
  console.log(data.length, i < data.length)
  while (i < data.length) {
    dat = data[i];
    var a = document.createElement("a");
    a.href=dat.url;
    var li = document.createElement("li");
    li.id="item";
    var img = document.createElement("img");
    img.src=dat.img;
    img.id="img";
    li.appendChild(img);
    var title = document.createElement("div");
    title.id="title";
    title.textContent=dat.name;
    li.appendChild(title);
    var desc = document.createElement("div");
    desc.id="desc";
    desc.textContent=dat.desc;
    li.appendChild(desc);
    a.appendChild(li);
    document.querySelector("#grid").appendChild(a);
    i++;
  }
});

I don’t know what is causing that element to be out of place.

How to integrate JWPlayer with React

I am looking for a way to integrate a JWPlayer with React, I know this is possible using their cloud hosted player on a static server-rendered language, but im finding it nearly impossible to make this happen elsewhere. I’ve been looking around the forums as well and the option that most people used previously which was react-jw-player doesnt look like its being supported anymore you cant install the package via npm and JWPlayer doesnt provide any documentation on how to work with their player in different frameworks.

so im wondering if there is a way to implement their cloud player from their cdn that they give you, for example, in their documentation
you would use a script tag to load the .js with an https that they provide you for the player, and then you can initialize a player from there.
looks like this:

***this is in the header***
<script src="https://cdn.jwplayer.com/.../.."></script>
**************************
<div id="myElement"></div>

    <script type="text/JavaScript">
        jwplayer("myElement").setup({ 
        "playlist": [{
           "file": "videourl"
            }]
        });
    </script>

I’d like to think that this is somewhat possible to do in react as well, but simply adding the cdn to the header in the index.js file, and then trying to instantiate a player object doesnt work, (if only it were that simple right?)

so im reaching out to the broader community in hopes someone might have a lead for me on how to use JWPlayer in React

Аfter the second execution, findOne gives incorrect info when sorting by newness

This part of the code should perform a cooldown, but it only works fine on the first two calls, and after that it simply does not find newer entries

      history
        .findOne({ sender: ctx.message.from.id, type: true })
        .sort([["date", -1]])
        .exec(async function (err, data) {
          if (!data) {
            let createLog = new history({
              type: true,
              title: `${Math.floor(Math.random() * (1 - 10 + 1) + 1)}`,
              sender: ctx.message.from.id,
            });
            await createLog.save();
          } else {
            let dateOMG = new Date() - (await data.date);
            let diffMins = Math.round(((dateOMG % 86400000) % 3600000) / 60000);
            let diffHrs = Math.floor((dateOMG % 86400000) / 3600000);
            let diffDays = Math.floor(dateOMG / 86400000);

            if (diffMins >= 1 || diffHrs > 0 || diffDays > 0) {
              console.log(data);
              console.log(diffMins, diffHrs, diffDays);
              console.log(new Date(), data.date);
             
              let createLog = new history({
                type: true,
                title: `${Math.floor(Math.random() * (1 - 10 + 1) + 1)}`,
                sender: ctx.message.from.id,
              });

              await createLog.save();
            } else {
              await ctx.reply(
                "cooldown"
              );
            }
          }
        });
    
  

In console:

The first time the function is executed

{
  _id: new ObjectId("61ec63530e6653456df4db58"),
  type: true,
  date: 2022-01-22T20:04:27.414Z,
  title: '-3',
  sender: 'omg',
  __v: 0
}
33 1 0
2022-01-22T21:37:34.360Z 2022-01-22T20:04:27.414Z

Next and all after it, it just ignores new entries

{
  _id: new ObjectId("61ec791ee1b0c54e66fd24d4"),
  type: true,
  date: 2022-01-22T21:37:29.147Z,
  title: '-7',
  sender: 'lol',
  __v: 0
}
1 0 0
2022-01-22T21:38:44.429Z 2022-01-22T21:37:29.147Z

Convert proxy object to normal object vue JS

I have been trying to convert excel file to Json and the problem is that when I want to add this data to an array in the component’s data , I am unable to do that.
I tried to see what is happening in the console , and the component’s data is changed to proxy object.
here’s my data :

  data(){ 
  return {
    arr: [],
  };
  },

here’s my function :

    onChange(event) {
      var input = event.target;
      var reader = new FileReader();
      reader.readAsBinaryString(input.files[0]);
      reader.onload = () => {
        var fileData = reader.result;
        var wb = XLSX.read(fileData, {type : 'binary'});
        wb.SheetNames.forEach((sheetName) => {
            var rowObj =XLSX.utils.sheet_to_json(wb.Sheets[sheetName]);
            for(const item of rowObj) {
                this.arr.push(item);
          }
        })
        console.log(this.arr);


      }; 

    },

doing console.log(this.arr[1]) or any number outside the onload function will result in an undefined message.

Javascript: Add leaflet polyline on marker click

For a project I am trying to use a leaflet map. These map will have a lot of markers. When clicking on one of these markers, I want to open a popup within the map as well as displaying a polyline. It should be possible to open multiple markers at a time.

Right now, I have stored all polylines in separate variables polyline1, polyine2, …, and show and hide them as an popupopen / popupclose event. As these polylines are quite long and complex, the loading performance of the size is decreasing drastically with increasing number of markers. That’s why I am thinking of dynamically loading the polylines just in time when clicking on a marker by an AJAX request.

However, even without the AJAX request, I am not able to remove a polyline when the popup is closed. Instead I am receiving an javascript error, that “polyline is not defined”, as you can see in the snippet below.

As far as I understand, the polyline variable is not longer available in the popupclose event. Is there a possiblity to assign the polyline created at on popupopen event with the respective popupclose event?

// center of the map
var pos1 = [-33.8650, 151.2094];
var pos2 = [-34.8650, 150.2094];

// Create the map
var map = L.map('map').setView(pos1, 6);

// Set up the OSM layer
L.tileLayer(
  'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    maxZoom: 18
  }).addTo(map);

// add a marker in the given location
marker1 = L.marker(pos1).addTo(map);
marker2 = L.marker(pos2).addTo(map);

marker1.bindPopup('Sydney',{closeOnClick: false, autoClose: false}).on('popupopen',
  function(e) {
    var polyline = L.polyline([
      [-33.8650, 151.2094],
      [52.51975, 13.38017]
    ]);
    map.addLayer(polyline);
  }
).on('popupclose', function(e) {
  map.removeLayer(polyline);
});

marker2.bindPopup('Canberra',{closeOnClick: false, autoClose: false}).on('popupopen',
  function(e) {
    var polyline = L.polyline([
      [-34.8650, 150.2094],
      [52.51975, 13.38017]
    ]);
    map.addLayer(polyline);
  }
).on('popupclose', function(e) {
  map.removeLayer(polyline);
});
#map {
  height: 400px;
  width:600px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-beta.2.rc.2/leaflet.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-beta.2.rc.2/leaflet.js"></script>

<div id="map"></div>

javascript form not validating fields

I’m trying to validate a form via javascript onSubmit, then run the php captcha verfication and email send action. The problem is that every time I try to check the fields, I can see just one of them highlited with my CSS classes (seems to be related to the ‘return false;’ which blocks me).

Anyone has a clue?

Here’s my HTML form code:

<form id="contact-form" class="contact" name="contact-form" method="POST" onsubmit="return checkInputs()" action="indexen.php">
                    <div class="fields">
                        <div class="field name">
                            <input type="text" name="name" id="name" placeholder="Name">
                            <i class="fas fa-check-circle"></i>
                            <i class="fas fa-exclamation-circle"></i>
                            <small>Error Message</small>
                        </div>
                        <div class="field email">
                            <input type="text" name="email" id="email" placeholder="Email">
                            <i class="fas fa-check-circle"></i>
                            <i class="fas fa-exclamation-circle"></i>
                            <small>Error Message</small>
                        </div>
                    </div>
                    <div class="field">
                        <input type="text" name="subject" id="subject" placeholder="Subject">
                        <i class="fas fa-check-circle"></i>
                        <i class="fas fa-exclamation-circle"></i>
                        <small>Error Message</small>
                    </div>
                    <div class="field textarea">
                        <textarea name="message" id="message" cols="30" rows="10" placeholder="Message..."></textarea>
                        <i class="fas fa-check-circle"></i>
                        <i class="fas fa-exclamation-circle"></i>
                        <small>Error Message</small>
                    </div>
                    <div class="button-area">
                    <button type="submit" name="submit">Submit</button>
                    </div>  
                </form>

And this is my validator.js file:

const username = document.getElementById('name');
const email = document.getElementById('email');
const subject = document.getElementById('subject');
const msg = document.getElementById('message');

function checkInputs() {

    const usernameValue = username.value.trim();
    const emailValue = email.value.trim();
    const subjectValue = subject.value.trim();
    const msgValue = msg.value.trim();

    if(usernameValue === '') {
        setErrorForUser(username, 'Name cannot be blank');
        return false;
    }
    else{
        setSuccessForUser(username);
    }

    if(emailValue === '') {
        setErrorForEmail(email, 'Email cannot be blank');
        return false;
    }

    else if(!isEmail(emailValue)){
        setErrorForEmail(email, 'Invalid email');
        return false;
    }

    else {
        setSuccessForEmail(email);
    }
    
    if(subjectValue === '') {
        setErrorForSubject(subject, 'Subject cannot be blank');
        return false;
    }

    else{
        setSuccessForSubject(subject);
    }

    if(msgValue === '') {
        setErrorForMsg(msg, 'Message cannot be blank');
        return false;
    }

    else{
        setSuccessForMsg(msg);
    }

    return true;

}

function setErrorForUser(input, message) {

    const formControl = input.parentElement;
    
    const small = formControl.querySelector('small');

    small.innerText = message;

    formControl.className = 'field error name';
}

function setSuccessForUser(input) {

    const formControl = input.parentElement;

    formControl.className = 'field name success';
}

function setErrorForEmail(input, message) {
    const formControl = input.parentElement;
    
    const small = formControl.querySelector('small');

    small.innerText = message;

    formControl.className = 'field email error';
}

function setSuccessForEmail(input) {

    const formControl = input.parentElement;

    formControl.className = 'field email success';
}

function setErrorForMsg(element, message) {

    const formControl = element.parentElement;
    
    const small = formControl.querySelector('small');

    small.innerText = message;

    formControl.className = 'field textarea error';
}

function setSuccessForMsg(element) {

    const formControl = element.parentElement;

    formControl.className = 'field textarea success';
}


function setErrorForSubject(input, message) {

    const formControl = input.parentElement;
    
    const small = formControl.querySelector('small');

    small.innerText = message;

    formControl.className = 'field error';
}

function setSuccessForSubject(input) {

    const formControl = input.parentElement;

    formControl.className = 'field success';
}

function isEmail(email) {
    return /^(([^<>()[]\.,;:s@"]+(.[^<>()[]\.,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/.test(email);
}

CSS is not necessary since it has only the working clases. Same as PHP which is working.

I’m adding some pictures to refer this. This is what I get:

error

But I want to get something like this:

example

To validate field per field like this:

validation

Thanks in advance,

No overload matches this call – Angular 13

It’s been days with this issue I’m having lately.

I’m trying to iterate over a Object in JSON but I cannot have access to.

I’ve created lots of posts before relating the same issue, but I cannot find the solution.


I’m trying to iterate this very JSON from my API (Node.js):

{
    "id": 1,
    "title": "App Komputer",
    "description": "Website dedicated to computer related products",
    "accessCode": "5128",
    "createdAt": "2022-01-13T21:19:11.000Z",
    "updatedAt": "2022-01-13T21:19:16.000Z",
    "sprints": [{
        "id": 1,
        "title": "Sprint 1",
        "releaseDate": "2022-01-20T21:37:13.000Z",
        "description": "Specs up to 01/22/2022",
        "createdAt": "2022-01-13T21:37:58.000Z",
        "updatedAt": "2021-12-13T01:46:36.000Z",
        "projectId": 1,
        "specifications": [{
            "id": 1,
            "title": "Add product button",
            "description": "New product button HTML",
            "duration": 10,
            "status": 1,
            "createdAt": "2021-12-23T01:46:36.000Z",
            "updatedAt": "2021-12-23T01:46:36.000Z",
            "sprintId": 1
        }]
    }]
}

This is my project-details.component.ts, from where through the function getProject() I get the JSON.

import { Component, Input, OnInit } from '@angular/core';
import { ProjectService } from 'src/app/services/project.service';
import { ActivatedRoute, Router } from '@angular/router';
import { Project } from 'src/app/models/project.model';
import { Title } from "@angular/platform-browser";
import { Moment } from 'moment';
import { EChartsOption } from 'echarts';

@Component({
  selector: 'app-project-details',
  templateUrl: './project-details.component.html',
  styleUrls: ['./project-details.component.css']
})
export class ProjectDetailsComponent implements OnInit {

  @Input() viewMode = false;

  @Input() currentProject: Project = {
    title: '',
    description: '',
    accessCode: ''
  };
  
  message = '';

  constructor(
    private projectService: ProjectService,
    private route: ActivatedRoute,
    private router: Router,
    private _titleService: Title
    ) { }

  ngOnInit(): void {
    if (!this.viewMode) {
      this.message = '';
      this.getProject(this.route.snapshot.params["id"]);
    }
  }

  getProject(id: string): void {
    this.projectService.get(id)
      .subscribe({
        next: (data) => {
          this.currentProject = data;
          console.log(data);
          this._titleService.setTitle(data.title+' · Scrumy');
        },
        error: (e) => console.error(e)
      });
  }

}

I need to access the sub array called sprints from my template, which is:

<mat-toolbar>
    <span>{{ currentProject.title }}</span>
</mat-toolbar>
<div class="data-panel">
  <mat-card>
    <mat-toolbar style="border-radius: 4px 4px 0px 0px;">
              <span>Development</span>
          </mat-toolbar>
          <mat-card-content>
            <span>Access Code: {{ currentProject.accessCode }}</span>
            <div *ngFor="let item of currentProject | keyvalue">
              {{item.key}}:{{item.value}}
            </div>
          </mat-card-content>
  </mat-card>
</div>

But with this, I got this error:

Compiled with problems:X

ERROR

src/app/components/project-details/project-details.component.html:11:38 - error TS2769: No overload matches this call.
  The last overload gave the following error.
    Argument of type 'Project' is not assignable to parameter of type 'Record<keyof Project, any> | ReadonlyMap<keyof Project, any> | null | undefined'.

11             <div *ngFor="let item of currentProject | keyvalue">
                                        ~~~~~~~~~~~~~~

  src/app/components/project-details/project-details.component.ts:11:16
    11   templateUrl: './project-details.component.html',
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component ProjectDetailsComponent.

I don’t know what to do from now on.

If I get the first level data from the JSON (f.e: title), it will work correctly. But if I try to iterate over the subarray, I get this very error.

How can I solve this?

Thank you very much for your wisdom and experience.