How can I access custom meta fields in a JS file?

I have created a custom meta field for variants with namespace and key like this custom.variant_images. In the Liquid file, I can access it this way {{variant.metafields.custom.variant_images}}.

But now I want to access it from my JS file. I managed to get a JSON output for a product, but under variants, I can’t find a line for my custom meta field. How can I access it? Some code example is appreciated.

Have you been able to have an solution?