Need to adapt sql query and remove quotations - resursivelly

Hi, since I’m not able to solve this problem, any help is more than welcome. This is part of the data coming from Mariadb. Please help me to clean it by removing quotations at objects and arrays (nested structure).


const data = [
    {
        "post_id":8,
        "type":1,
        "author":"Marta",
        "categories":"[\"ludzie\"]",
        "tags":"[\"accesories\",\"handcraft\"]",
        "featured_img":"{\"file\": \"1.jpg\", \"2x\": null}",
        "images":'["{\\"file\\": \\"Fiolet i zieleń.png\\", \\"2x\\": null, \\"3x\\": null, \\"pinIt\\": false, \\"alt\\": \\"Piękny obraz\\", \\"figcaption\\": null}","{\\"file\\": \\"Moja Japonia.jpg\\", \\"2x\\": null, \\"3x\\": null, \\"pinIt\\": true, \\"alt\\": \\"aaa\\", \\"figcaption\\": null}"]'
    },
    {
        "post_id":7,
        "type":1,
        "author":"Marta",
        "categories":"[\"ludzie\"]",
        "tags":"[\"accesories\",\"handcraft\"]",
        "featured_img":"{\"file\": \"IMG_1293-2.jpg\", \"2x\": null}",
        "images":'["{\\"file\\": \\"Fiolet i zieleń.png\\", \\"2x\\": null, \\"3x\\": null, \\"pinIt\\": false, \\"alt\\": \\"Piękny obraz\\", \\"figcaption\\": null}","{\\"file\\": \\"Moja Japonia.jpg\\", \\"2x\\": null, \\"3x\\": null, \\"pinIt\\": true, \\"alt\\": \\"aaa\\", \\"figcaption\\": null}"]'
    }
];

But it doesn’t have to be done recursively, or in the SQL. If this were me and i needed to remove those \" characters, I’d look for an easy way.

What about if we turn the nested object to a string, replace the ones you don’t want with an empty string, and then convert it back to an object?

So Regex, right? Please have a look at images values with all chars to be removed (surrounded by stars ).

 "images":  *'*[   *"*{   *\\*    "file    *\\*     ": .............