Convert JSON-like String to JSON

I have a String that describes an object and want to convert it into a JS Object.

String:

{
    "platform": "desktop",
    pageName: "JD Sports - Nike Air Force 1  07 LV8 Herren", //Page Title
    pageType: "product", //Page Type
    plu: "16085947_jdsportsde", //Product Code
    description: "Nike Air Force 1  07 LV8 Herren", //Product Name
    unitPrice: "110.00", //Product Price
                    category: "Herren \u003E Herrenschuhe \u003E Sneakers", //End level category
    categoryId: "jdsportsde_ct81275jdsportsde_ct81279jdsportsde_ct81356jdsportsde", //End level category Id
            sale: false, //is on sale? true/false
    brand: "Nike", //Product Brand
    ownbrand: false, //own brand product? true/false
    exclusive: false, //exclusive product? true/false
    onlineexlusive: false, //online exlcusive product? true/false
    currency:"EUR",
    variants: [
                                                            {
                            name:"41",
                            upc: "0194501189583",
                            page_id_variant: "16085947_jdsportsde.0194501189583"
                    }
                                    ,                       {
                            name:"42.5",
                            upc: "0194501189606",
                            page_id_variant: "16085947_jdsportsde.0194501189606"
                    }
                                    ,                       {
                            name:"45",
                            upc: "0194501189644",
                            page_id_variant: "16085947_jdsportsde.0194501189644"
                    }
                                    ,                       {
                            name:"47",
                            upc: "0194501189675",
                            page_id_variant: "16085947_jdsportsde.0194501189675"
                    }
                                    ,                       {
                            name:"47.5",
                            upc: "0194501189682",
                            page_id_variant: "16085947_jdsportsde.0194501189682"
                    }
                                    ,                       {
                            name:"48.5",
                            upc: "0194501189699",
                            page_id_variant: "16085947_jdsportsde.0194501189699"
                    }
                                    ,                       {
                            name:"L",
                            upc: "0194501189569",
                            page_id_variant: "16085947_jdsportsde.0194501189569"
                    }
    ]
};

Because the keys arent in quotation marks and because of the comments I can’t use JSON.parse()
How can i convert my String into an object?

19 thoughts on “Convert JSON-like String to JSON”

  1. 373890 187531I like what you guys are up also. Such intelligent work and reporting! Maintain up the superb works guys Ive incorporated you guys to my blogroll. I believe itll improve the value of my web site . 12629

    Reply