JSFiddle - React, Tailwind, and code Playground

by irinablue

JavaScript

/*const str = '[
    {
        "input": {
            "get": "text",
            "where": [
                ".autocomplete__item",
                ".autocomplete-suggestion"
            ],
            "find": {
                "from": "closest"
            }
        }
    },
    {
        "input": {
            "get": "value",
            "where": [
                "#search",
                "[aria-label=\"search\"]"
            ]
        }
    }
]';*/

//const str = '{ "input": {"get": "value"}, "where": ["#search", "[aria-label=\\"search\\"]"] }';

const obj = [{
    input: {
        get: 'value',
        where: [
            '#search',
            '[aria-label="search"]'
        ]
    }
},
{
    input: {
        get: 'value2',
        where: [
            '#search'
        ]
    }
}];
const str = JSON.stringify(obj);
const json = JSON.parse(str);
console.log(Array.isArray(json))
console.log(json)