Unable to save an array of objects to wix local storage?

Hi Wix community,
I am attempting to store an array of objects containing registrant information since wix stores does not allow the sales of like an event. Wix events does not work well enough, because it is for a race and I have to request all of their information. So I have a custom form. I currently have an array of object so every time another registrant is added to the cart, the registrants info is saved to the array. However I want this array to still be around when they move to the cart page, and then after payment the array of objects is saved to the registered participants database.

To save the array to session storage I used:

import {session} from 'wix-storage';
session.setItem("registrantsAdded", participantArrayObjectsCart);

and to get the array on the cart page I used:

import {session} from 'wix-storage';
let tempVar = session.getItem("registrantsAdded")
console.log(tempVar);

but I did a console.log of the save session key and it reports NULL

Any help would be great!

Are you wrapping these in the onReady or some event listener?

Hello David,
Yes I’m wrapping this in an event listener. Except the import statement. that’s at the very top.

@logan Then the problem is probably with the construction of your array. Go ahead and post that function here.