data JSON from api to repeater

Hello, I can't send a json from an api to a repeater. If anyone could help me. The problem is that the json data is not displayed in the repeater
Cordially

async function CallSportDataLive() {

     const callSportData = await SportData($w('#dropdown1').value)
         console.log("SportData" + JSON.stringify(callSportData));
         console.log("count " + callSportData.length)

$w.onReady(function () {
   $w("#repeater2").data = callSportData
  $w("#repeater2").onItemReady( ($item, itemData, index) => {
    $item("#text58").text = itemData.name;

  } );

})
}
const callCallSportDataLive = await CallSportDataLive()
console.log("callCallSportDataLive")

FYou shouldn’t put the $w inside the function. But do something like:

$w.onReady(() => {
 $w('#dropdown1').onChange(() => {
  SportData($w('#dropdown1').value)
  .then(results => {
     //continue from here and bind the data to the repeater
   })
 })
})

Second. it depends on what the SportData returns. If it returns a json, you should parse it first.

Thank you for your response, but it does not work

$w . onReady ( ( ) => {
$w ( ‘#dropdown1’ ) . onChange ( ( ) => {
SportData ( $w ( ‘#dropdown1’ ) . value )
. then ( results => {
console . log ( "results " + JSON . stringify ( results ))
$w ( “#repeater2” ). data = results
$w ( “#repeater2” ). onItemReady ( ( $item , itemData , index ) => {
$item ( “#text58” ). text = itemData . name
} )
} )
} )
})

Anyone can help me please ?

Seems like you do not give enough informations.

import wixData from 'wix-data';

$w.onReady(async function() {
    let callSportData = await JSON.stringify(SportData($w('#dropdown1').value));    
    console.log("Sport-Data-1: ", callSportData);
    //--------------------------------------------
    let callCallSportDataLive = await CallSportDataLive();          
    console.log("Sport-Data-2: ", callCallSportDataLive);
    //--------------------------------------------
    console.log("count " + callSportData.length)
    //--------------------------------------------
    $w("#repeater2").data = callSportData
    //--------------------------------------------
     
    $w("#repeater2").onItemReady(($item, itemData, index) => {
        $item("#text58").text = itemData.name;
    });
});


function callSportData() {........................};

function callCallSportDataLive() {........................};

Place anything before onReady() inside your code.
OnReady should be the very first line in your CODE.

Never use more than 1-onReady() !!!

It is not clear where callSportData is located, or where to find. Also not clear what exactly the result of this function is (RETURNING-Function).

The same for callCallSportDataLive, where this functions can be found in your code?

Running on BACKEND ??? If running on Backend = you did not show the imports.

Your informations are INCOMPLETE.

Your REPEATER must have the following STRUCTURE to be filled with…

[
  {
    "_id": "1",
    "firstName": "John",
    "lastName": "Doe",
    "image": "http://someImageUrl/john.jpg"
  },
  {
    "_id": "2",
    "firstName": "Jane",
    "lastName": "Doe",
    "image": "http://someImageUrl/jane.jpg"
  }
]

What exactly are you trying to display in the repeater? Just the name?

It is not going to be possible to just pass the data into the repeater as the repeater elements need a unique _id prop. See: data - Velo API Reference - Wix.com

You can try something like this:

.then(results => {
    const repeaterData = {
        _id: any unique stringified value,
        name: results.name,
        ...etc
    }
    $w("#repeater2").data = repeaterData
})

Also try moving the $w(“#repeater2”).onItemReady function to the $w.onReady function so it gets read when the page is loaded.

Hello, thanks you for your answer.

Here you have all my code…

import { fetch } from ‘wix-fetch’ ;
import { getJSON } from ‘wix-fetch’ ;
import { getUFvalue } from ‘backend/Football.jsw’ ;
import { multiply } from ‘backend/Football.jsw’ ;
import wixData from ‘wix-data’ ;
import wixwindow from ‘wix-window’ ;
//import {ListCompetition} from ‘backend/ScriptFoot.jsw’
//import {Header} from ‘backend/ScriptFoot.jsw’
//import {Profile} from ‘backend/ScriptFoot.jsw’
//import {Squad} from ‘backend/ScriptFoot.jsw’
import { LiveSportSport } from ‘backend/ScriptFoot.jsw’
import { LiveSportOdds } from ‘backend/ScriptFoot.jsw’
import { LiveSportScore } from ‘backend/ScriptFoot.jsw’
import { SportList } from ‘backend/ScriptFoot.jsw’
import { SportData } from ‘backend/ScriptFoot.jsw’
import { SportVenue } from ‘backend/ScriptFoot.jsw’

$w . onReady ( async function () {

//const callListCompetition = await ListCompetition()
//console.log("callListCompetition " + JSON.stringify(callListCompetition))

//const callHeader = await Header()
//console.log("callHeader " + JSON.stringify(callHeader))

//const callProfile = await Profile()
//console.log("callProfile " + JSON.stringify(callProfile))

//const callSquad = await Squad()
//console.log("callSquad " + JSON.stringify(callSquad))

//const callLiveSportSport = await LiveSportSport()
//console.log("callLiveSportSport " + JSON.stringify(callLiveSportSport))

//const callLiveSportOdds = await LiveSportOdds()
//console.log("callLiveSportOdds " + JSON.stringify(callLiveSportOdds))

//const callLiveSportScore = await LiveSportScore()
//console.log("callLiveSportScore " + JSON.stringify(callLiveSportScore))

//const callSportList = await SportList()
//console.log("callSportList " + JSON.stringify(callSportList))

$w . onReady ( ( ) => {
$w ( ‘#dropdown1’ ) . onChange ( ( ) => {
SportData ( $w ( ‘#dropdown1’ ) . value )
. then ( results => {
console . log ( "results " + JSON . stringify ( results ))
$w ( “#repeater2” ). data = results
$w ( “#repeater2” ). onItemReady ( ( $item , itemData , index ) => {
$item ( “#text58” ). text = itemData . name
} )
} )
} )
})

})

Exactly!

“id” is already given inside the results, but wrong written declaration of “id”

not → “id”
instead → “_id”

Already mentioned in my post above (see standard REPEATER-DATA-STRUCTURE).

apologies. Did not see your comment.

Should I change "id" to "_id" in the json from api ?

Well, now everybody can see that you are using BACKEND-CODE, even if we do not see what exactly happens on backend, we now know what you are trying to do.

I assume you are FETCHING on BACKEND to get DATA from another SITE.

We can see results as constant declarations here…

const callListCompetition = await ListCompetition()
console.log("callListCompetition " + JSON.stringify(callListCompetition))

const callHeader = await Header()
console.log("callHeader " + JSON.stringify(callHeader))

const callProfile = await Profile()
console.log("callProfile " + JSON.stringify(callProfile))

const callSquad = await Squad()
console.log("callSquad " + JSON.stringify(callSquad))

const callLiveSportSport = await LiveSportSport()
console.log("callLiveSportSport " + JSON.stringify(callLiveSportSport))

const callLiveSportOdds = await LiveSportOdds()
console.log("callLiveSportOdds " + JSON.stringify(callLiveSportOdds))

const callLiveSportScore = await LiveSportScore()
console.log("callLiveSportScore " + JSON.stringify(callLiveSportScore))

const callSportList = await SportList()
console.log("callSportList " + JSON.stringify(callSportList))

My first question: Why you need to stringify for console? Is that needed???
Isn’t your RESULT from BACKEND already → STRING-DATA ???

Maybe you want to parse it back to a normal DATA-OBJECT?

JSON.parse("Your_Fetched_String_Data_Here");

SOMETHING LIKE…

let mySemiPreparedRepeaterData = JSON.parse("Your_Fetched_String_Data_Here");
  • ADDING → “_id” by a LOOP-FUNCTION to all OBJECT-ITEMS.

Should I change “id” to "_id"in the json from api ?

You have 2-options!

  1. You change it in your sending element.
  2. You change it in your recieving element.

Your FETCHED-DATA includes → “id” ← what seems to be wrong.

How to solve in recieved element?
a) convert fetched STRING-DATA back to an → Object using → PARSE.
b) Generate a function to loop trough your whole OBJECT → adding “_id” to every single Object-Items inside the array.

So inside every included OBJECT-ITEM-DATA, you would have “id” and “_id” included. Now your REPEATER-DATA would be ready to work inside a REPEATER.

Hi, thank for your response, I will try your solution and I come back to you !

You need to assign to each item a property key " _id " with a unique string value.

  • please post one item for example (and not as screnshot).

Hello, i have try your solution but it’s not working… I don’t see the data in the repeater.

import {fetch} from 'wix-fetch';
import {getJSON} from 'wix-fetch';
import {getUFvalue} from 'backend/Football.jsw';
import {multiply} from 'backend/Football.jsw';
import wixData from 'wix-data';
import wixwindow from 'wix-window';
import {SportData} from 'backend/ScriptFoot.jsw'


$w . onReady ( ( )  =>  { 

  SportData ( $w ( '#dropdown1' ) . value ) 
  . then ( results  =>  { 
    //console.log("results " + JSON.stringify(results))
    var count = 0
    var stringResults =  JSON.stringify(results)         
    var parseResults = JSON.parse(stringResults)         
    parseResults.forEach((element) => {
    
    count++

//console.log("element.id" + JSON.stringify(element.id))
element._id = count
    })
    console.log("parseResults " + JSON.stringify(parseResults))



     $w("#repeater2").data = parseResults
  $w("#repeater2").onItemReady( ($item, itemData, index) => {
    console.log("itemData " + JSON.stringify(itemData))
    $item("#text58").text = itemData.name
   } ) 
 } ) 




 $w ( '#dropdown1' ) . onChange ( ( )  =>  { 
    SportData ( $w ( '#dropdown1' ) . value ) 
  . then ( results  =>  { 
    //console.log("results " + JSON.stringify(results))
    var count = 0
    var stringResults =  JSON.stringify(results)         
    var parseResults = JSON.parse(stringResults)         
    parseResults.forEach((element) => {
    
    count++

//console.log("element.id" + JSON.stringify(element.id))
element._id = count
    })
    console.log("parseResults " + JSON.stringify(parseResults))



     $w("#repeater2").data = parseResults
  $w("#repeater2").onItemReady( ($item, itemData, index) => {
    console.log("itemData " + JSON.stringify(itemData))
    $item("#text58").text = itemData.name
   } ) 
 } )

 

})


})

In the console i received the data

parseResults [{“id”:1213195,“sport_id”:1,“home_team_id”:4086,“away_team_id”:4049,“league_id”:261,“challenge_id”:537,“season_id”:14617,“venue_id”:7202,“referee_id”:508,“slug”:“2022-08-07-skovde-aik-osters-if”,“name”:“Skövde AIK – Östers IF”,“status”:“inprogress”,“status_more”:“2nd half”,“time_details”:null,“home_team”:{“id”:4086,“sport_id”:1,“category_id”:33,“venue_id”:7202,“manager_id”:8173,“slug”:“skovde-aik”,“name”:“Skövde AIK”,“has_logo”:true,“logo”:“https://tipsscore.com/resb/team/skovde-aik.png",“name_translations”:{“en”:"Skövde AIK”,“ru”:“Скёвде АИК”,“de”:“Skövde AIK”,“es”:“Skovde AIK”,“zh”:“舍夫德AIK”,“tr”:“Skövde”,“el”:“Σκόβντε”,“nl”:“Skovde AIK”,“pt”:“Skovde AIK”},“name_short”:“Skövde”,“name_full”:“Skövde AIK”,“name_code”:“SKO”,“has_sub”:false,“gender”:“M”,“is_nationality”:false,“country_code”:“SWE”,“country”:“Sweden”,“flag”:“sweden”,“foundation”:null},“away_team”:{“id”:4049,“sport_id”:1,“category_id”:33,“venue_id”:1480,“manager_id”:2863,“slug”:“osters-if”,“name”:“Östers IF”,“has_logo”:true,“logo”:“https://tipsscore.com/resb/team/osters-if.png",“name_translations”:{“en”:"Östers IF”,“ru”:“Эстер”,“zh”:“奥斯达”,“el”:“Οστέρς”,“pt”:“Osters IF”},“name_short”:“Öster”,“name_full”:“Östers IF”,“name_code”:“OST”,“has_sub”:false,“gender”:“M”,“is_nationality”:false,“country_code”:“SWE”,“country”:“Sweden”,“flag”:“sweden”,“foundation”:“2017-09-17 00:00:00”},“start_at”:“2022-08-09 17:00:00”,“priority”:1,“home_score”:{“current”:0,“display”:0,“period_1”:0},“away_score”:{“current”:0,“display”:0,“period_1”:0},“winner_code”:0,“aggregated_winner_code”:null,“result_only”:false,“coverage”:null,“ground_type”:null,“round_number”:18,“series_count”:11,“medias_count”:null,“status_lineup”:null,“first_supply”:null,“cards_code”:“00”,“event_data_change”:“00”,“lasted_period”:“period_1”,“default_period_count”:2,“attendance”:null,“cup_match_order”:null,“cup_match_in_round”:null,“periods”:null,“round_info”:{“round”:18},“periods_time”:null,“main_odds”:{“outcome_1”:{“value”:3.22,“change”:1},“outcome_X”:{“value”:3.32,“change”:0},“outcome_2”:{“value”:2.17,“change”:-1}},“league”:{“id”:261,“sport_id”:1,“section_id”:33,“slug”:“sweden-superettan”,“name”:“Superettan”,“name_translations”:{“en”:“Superettan”,“ru”:“Суперэттан”},“has_logo”:true,“logo”:“https://tipsscore.com/resb/league/sweden-superettan.png"},“challenge”:{“id”:537,“sport_id”:1,“league_id”:261,“slug”:“superettan”,“name”:“Superettan”,“name_translations”:{“en”:“Superettan”,“ru”:“Суперэттан”},“order”:48,“priority”:0},“season”:{“id”:14617,“league_id”:261,“slug”:“2022”,“name”:"Superettan 2022”,“year_start”:2022,“year_end”:null},“section”:{“id”:33,“sport_id”:1,“slug”:“sweden”,“name”:“Sweden”,“priority”:0,“flag”:“sweden”},“sport”:{“id”:1,“slug”:“football”,“name”:“Football”},“_id”:1},{“id”:1213198,“sport_id”:1,“home_team_id”:4047,“away_team_id”:4044,“league_id”:261,“challenge_id”:537,“season_id”:14617,“venue_id”:1459,“referee_id”:696,“slug”:“2022-08-07-norrby-if-ik-brage”,“name”:“Norrby IF – IK Brage”,“status”:“inprogress”,“status_more”:“2nd half”,“time_details”:null,“home_team”:{“id”:4047,“sport_id”:1,“category_id”:33,“venue_id”:1459,“manager_id”:1480,“slug”:“norrby-if”,“name”:“Norrby IF”,“has_logo”:true,“logo”:“https://tipsscore.com/resb/team/norrby-if.png",“name_translations”:{“en”:"Norrby IF”,“ru”:“Норрби ИФ”,“de”:“Norrby IF”,“es”:“Norrby IF”,“zh”:“诺尔比”,“tr”:“Norrby IF”,“el”:“Νόρμπι”,“nl”:“Norrby IF”,“pt”:“Norrby IF”},“name_short”:“Norrby”,“name_full”:“Norrby IF”,“name_code”:“NOR”,“has_sub”:false,“gender”:“M”,“is_nationality”:false,“country_code”:“SWE”,“country”:“Sweden”,“flag”:“sweden”,“foundation”:null},“away_team”:{“id”:4044,“sport_id”:1,“category_id”:33,“venue_id”:1477,“manager_id”:1477,“slug”:“ik-brage”,“name”:“IK Brage”,“has_logo”:true,“logo”:“https://tipsscore.com/resb/team/ik-brage.png",“name_translations”:{“en”:"IK Brage”,“ru”:“ИК Браге”,“de”:“IK Brage”,“es”:“IK Brage”,“zh”:“布莱格”,“tr”:“IK Brage”,“el”:“Μπράγκε”,“nl”:“IK Brage”,“pt”:“IK Braga”},“name_short”:“Brage”,“name_full”:“IK Brage”,“name_code”:“BRA”,“has_sub”:false,“gender”:“M”,“is_nationality”:false,“country_code”:“SWE”,“country”:“Sweden”,“flag”:“sweden”,“foundation”:null},“start_at”:“2022-08-09 17:00:00”,“priority”:1,“home_score”:{“current”:2,“display”:2,“period_1”:1},“away_score”:{“current”:1,“display”:1,“period_1”:1},“winner_code”:0,“aggregated_winner_code”:null,“result_only”:false,“coverage”:null,“ground_type”:null,“round_number”:18,“series_count”:11,“medias_count”:null,“status_lineup”:null,“first_supply”:null,“cards_code”:“00”,“event_data_change”:“00”,“lasted_period”:“period_1”,“default_period_count”:2,“attendance”:null,“cup_match_order”:null,“cup_match_in_round”:null,“periods”:null,“round_info”:{“round”:18},“periods_time”:null,“main_odds”:{“outcome_1”:{“value”:2.17,“change”:1},“outcome_X”:{“value”:3.42,“change”:-1},“outcome_2”:{“value”:3.12,“change”:-1}},“league”:{“id”:261,“sport_id”:1,“section_id”:33,“slug”:“sweden-superettan”,“name”:“Superettan”,“name_translations”:{“en”:“Superettan”,“ru”:“Суперэттан”},“has_logo”:true,“logo”:“https://tipsscore.com/resb/league/sweden-superettan.png"},“challenge”:{“id”:537,“sport_id”:1,“league_id”:261,“slug”:“superettan”,“name”:“Superettan”,“name_translations”:{“en”:“Superettan”,“ru”:“Суперэттан”},“order”:48,“priority”:0},“season”:{“id”:14617,“league_id”:261,“slug”:“2022”,“name”:"Superettan 2022”,“year_start”:2022,“year_end”:null},“section”:{“id”:33,“sport_id”:1,“slug”:“sweden”,“name”:“Sweden”,“priority”:0,“flag”:“sweden”},“sport”:{“id”:1,“slug”:“football”,“name”:“Football”},“_id”:2},{“id”:1213200,“sport_id”:1,“home_team_id”:4089,“away_team_id”:4039,“league_id”:261,“challenge_id”:537,“season_id”:14617,“venue_id”:1502,“referee_id”:842,“slug”:“2022-08-07-utsiktens-bk-trelleborgs-ff”,“name”:“Utsiktens BK – Trelleborgs FF”,“status”:“inprogress”,“status_more”:“2nd half”,“time_details”:{“prefix”:“”,“initial”:0,“max”:2700,“timestamp”:1660064411,“extra”:540},“home_team”:{“id”:4089,“sport_id”:1,“category_id”:33,“venue_id”:1502,“manager_id”:8312,“slug”:“utsiktens-bk”,“name”:“Utsiktens BK”,“has_logo”:true,“logo”:“https://tipsscore.com/resb/team/utsiktens-bk.png",“name_translations”:{“en”:"Utsiktens BK”,“ru”:“Утсиктенс БК”,“de”:“Utsiktens BK”,“es”:“Utsiktens BK”,“zh”:“尤特斯科腾”,“tr”:“Utsiktens”,“el”:“Ουτσίκτενς”,“nl”:“Utsiktens BK”,“pt”:“Utsiktens BK”},“name_short”:“Utsikten”,“name_full”:“Utsiktens BK”,“name_code”:“UTS”,“has_sub”:false,“gender”:“M”,“is_nationality”:false,“country_code”:“SWE”,“country”:“Sweden”,“flag”:“sweden”,“foundation”:null},“away_team”:{“id”:4039,“sport_id”:1,“category_id”:33,“venue_id”:1473,“manager_id”:1472,“slug”:“trelleborgs-ff”,“name”:“Trelleborgs FF”,“has_logo”:true,“logo”:“https://tipsscore.com/resb/team/trelleborgs-ff.png",“name_translations”:{“en”:"Trelleborgs FF”,“ru”:“ФК Треллеборг”,“de”:“Trelleborgs FF”,“es”:“Trelleborgs FF”,“zh”:“特利堡足球会”,“tr”:“Trelleborgs FF”,“el”:“Τρέλεμποργκ”,“it”:“Trelleborgs”,“nl”:“Trelleborgs FF”,“pt”:“Trelleborgs FF”},“name_short”:“Trelleborg”,“name_full”:“Trelleborgs FF”,“name_code”:“TRE”,“has_sub”:false,“gender”:“M”,“is_nationality”:false,“country_code”:“SWE”,“country”:“Sweden”,“flag”:“sweden”,“foundation”:null},“start_at”:“2022-08-09 17:00:00”,“priority”:1,“home_score”:{“current”:0,“display”:0,“period_1”:0},“away_score”:{“current”:0,“display”:0,“period_1”:0},“winner_code”:0,“aggregated_winner_code”:null,“result_only”:false,“coverage”:null,“ground_type”:null,“round_number”:18,“series_count”:12,“medias_count”:null,“status_lineup”:null,“first_supply”:null,“cards_code”:“00”,“event_data_change”:“00”,“lasted_period”:“period_1”,“default_period_count”:2,“attendance”:null,“cup_match_order”:null,“cup_match_in_round”:null,“periods”:null,“round_info”:{“round”:18},“periods_time”:null,“main_odds”:{“outcome_1”:{“value”:2.32,“change”:1},“outcome_X”:{“value”:3.52,“change”:0},“outcome_2”:{“value”:2.77,“change”:-1}},“league”:{“id”:261,“sport_id”:1,“section_id”:33,“slug”:“sweden-superettan”,“name”:“Superettan”,“name_translations”:{“en”:“Superettan”,“ru”:“Суперэттан”},“has_logo”:true,“logo”:“https://tipsscore.com/resb/league/sweden-superettan.png"},“challenge”:{“id”:537,“sport_id”:1,“league_id”:261,“slug”:“superettan”,“name”:“Superettan”,“name_translations”:{“en”:“Superettan”,“ru”:“Суперэттан”},“order”:48,“priority”:0},“season”:{“id”:14617,“league_id”:261,“slug”:“2022”,“name”:"Superettan 2022”,“year_start”:2022,“year_end”:null},“section”:{“id”:33,“sport_id”:1,“slug”:“sweden”,“name”:“Sweden”,“priority”:0,“flag”:“sweden”},“sport”:{“id”:1,“slug”:“football”,“name”:“Football”},“_id”:3}]

You don’t see anything inside the repeater, because your RESULT-DATA-STRUCTURE is still —> WRONG !!!

You don’t have —> _id <----- RIGHT !!!
You have -----------> id < ----- WRONG !!!

data = [
	{
	    "id":1213195, -------------> WRONG
	    "sport_id":1,
	    "home_team_id":4086,
	    "away_team_id":4049,
	    "league_id":261,
	    "challenge_id":537,
	    "season_id":14617,
	    "venue_id":7202,
	    "referee_id":508,
	    "slug":"2022-08-07-skovde-aik-osters-if",
	    "name":"Skövde AIK – Östers IF",
	    "status":"inprogress",
	    "status_more":"2nd half",
	    "time_details":null
	}
];
data = [
	{
	    "_id":1213195, -------------> RIGHT
	    "sport_id":1,
	    "home_team_id":4086,
	    "away_team_id":4049,
	    "league_id":261,
	    "challenge_id":537,
	    "season_id":14617,
	    "venue_id":7202,
	    "referee_id":508,
	    "slug":"2022-08-07-skovde-aik-osters-if",
	    "name":"Skövde AIK – Östers IF",
	    "status":"inprogress",
	    "status_more":"2nd half",
	    "time_details":null
	}
];

Hi,
Thanks for replay

_id is at the end of all item in object.
And i have let id in the start of all object.

Cordially

Do a manual test…

define the data as following …

let myData =[{"_id":1213195,"sport_id":1,"home_team_id":4086,"away_team_id":4049,"league_id":261,"challenge_id":537,"season_id":14617,"venue_id":7202,"referee_id":508,"slug":"2022-08-07-skovde-aik-osters-if","name":"Skövde AIK – Östers IF","status":"inprogress","status_more":"2nd half","time_details":null}];
let myData =[{"_id":1213195,"sport_id":1,"home_team_id":4086,"away_team_id":4049,"league_id":261,"challenge_id":537,"season_id":14617,"venue_id":7202,"referee_id":508,"slug":"2022-08-07-skovde-aik-osters-if","name":"Skövde AIK – Östers IF","status":"inprogress","status_more":"2nd half","time_details":null}];

$w.onReady(()=>{
    $w('#myRepeater').data = myData;
    
    $w.('#myRepeater').onItemReady(($item, itemData, index)=>{
        $item('#textElementIDhere').text = itemData._id:    
    });
});

Load a manual created DATA into your REPEATER and test the outputs of REPEATER.

Normaly it should work.

Just was currious why you have such problems with the REPEATER-DATA and now i know!!!

TEST THIS LITTLE TEST_SETUP !!!

let myData =[
    {
        "_id":"1213195",  <---- must be a STRING !!!!
        "sport_id":1,
        "home_team_id":4086,
        "away_team_id":4049,
        "league_id":261,
        "challenge_id":537,
        "season_id":14617
    }
];

$w.onReady(()=>{
    $w('#repeater1').data = myData;
    
    $w('#repeater1').onItemReady(($item, itemData, index)=>{
        $item('#button1').onClick(()=>{console.log(itemData._id);
            $item('#txt1').text = itemData._id;
        });           
    });
});

Maybe all other data in your OBJECT also has to be defined as STRINGs…

OLD DATA-OBJECT... <------ WRONG SYNTAX !!!
"sport_id":1,
"home_team_id":4086,
"away_team_id":4049,
"league_id":261,
"challenge_id":537,
"season_id":14617

NEW DATA-OBJECT....  <----- RIGHT SYNTAX !!!
"sport_id":"1",
"home_team_id":"4086",
"away_team_id":"4049",
"league_id":"261",
"challenge_id":"537",
"season_id":"14617"

I already mentioned the right DATA-STRUCTURE in one of my previous posts, but did not pay attention onto the correct SYNTAX !!!

Your REPEATER must have the following STRUCTURE to be filled with…

[
  {
    "_id": "1",
    "firstName": "John",
    "lastName": "Doe",
    "image": "http://someImageUrl/john.jpg"
  },
  {
    "_id": "2",
    "firstName": "Jane",
    "lastName": "Doe",
    "image": "http://someImageUrl/jane.jpg"
  }
]

Hmm yes, I had already understood the problem I admit, but it’s been 8 days that I can’t solve it.
I have tried various regex to add double quotes to digits and boolean but without success…

But you understand now the problem ?

What if you use JSON.stringify() ???
I don’t know if it will work, try it.

Else maybe VELO-MASTER @ J.D. has a good idea for you.
He has always good ideas!

Or you make it simple, and write a LOOP-FUNCTION, which adds the double-quotes.

By the way, REG-EX also not a bad idea, maybe even the best one!

I had a big post about REG-EX, but never used it again, and forgot a lot.

But you can take a look here…

Maybe it can give you some ideas and insights.

Some additional stuff…