从 RichSnippet JSON 中获取数据并将相同的字符串设置到其他变量中

Get data from RichSnippet JSON and set the same string into other variable

我有这个 JSON 从外部 (Reviews-io) 脚本生成的: https://widget.reviews.co.uk/rich-snippet/dist.js

    richSnippet({

        store: "www.storedigital.local",
        sku:"6647;6647_5;6647_4;6647_3;6647_11;6647_10;6647_2;6647_1;6647_9;6647_8;6647_7;6647_6",
        data:{
          "url": "store.stg.gsd.local/1/silla-replica-eames.html",
          "description": ``,
          "mpn": "6647",
          "offers" :[{
            "@type":"Offer",
            "availability": "http://schema.org/InStock",
            "price": "559",
            "priceCurrency": "MXN",
            "url": "https://store.stg.gsd.localx/1/silla-replica-eames.html",
            "priceValidUntil": "2022-05-26",
          }],
          "brand": {
           "@type": "Brand",
           "name": "Not Available",
         }
        }

    })

我需要获取“sku”中的所有数字字符串,然后将它们以相同格式放入另一个变量中(6647; 6647_1; 6647_2)

我尝试使用此 JS 获取数字但不起作用

var skucollection = JSON.parse(richSnippet, function (key, value) {
   if (key == "sku") {
     return new Sku(value);
    } else {
     return value;
    }
});

你能帮我检查一下我做错了什么吗?为了得到这个 sku 的值字符串,好吗?

JSON.parse是不是太多了? ,按原样处理它(确实是 JSON)

var richSnippet = {
  store: 'www.storedigital.local',
  sku: '6647;6647_5;6647_4;6647_3;6647_11;6647_10;6647_2;6647_1;6647_9;6647_8;6647_7;6647_6',
  algomas: [],
  data: {
    url: 'store.stg.gsd.local/1/silla-replica-eames.html',
    description: ``,
    mpn: '6647',
    offers: [
      {
        '@type': 'Offer',
        availability: 'http://schema.org/InStock',
        price: '559',
        priceCurrency: 'MXN',
        url: 'https://store.stg.gsd.localx/1/silla-replica-eames.html',
        priceValidUntil: '2022-05-26',
      },
    ],
    brand: {
      '@type': 'Brand',
      name: 'Not Available',
    },
  },
};
var test;
Object.keys(richSnippet).forEach((key) => {
  if (key == 'sku') {
    test = richSnippet[key];
  }
});

console.log('test', test);