saleor-dashboard/cypress/support/format/formatJson.js
Karolina 2173e241b5
Saleor 2692 tests for filtering products (#1055)
* test for filtering products

* tests for filters

* change filter input selector

* change filter input selector

* change filter input selector

* add data-test-id
2021-04-12 17:22:12 +02:00

12 lines
472 B
JavaScript

export function stringify(obj_from_json) {
if (typeof obj_from_json !== "object" || Array.isArray(obj_from_json)) {
// not an object, stringify using native function
return JSON.stringify(obj_from_json);
}
// Implements recursive object serialization according to JSON spec
// but without quotes around the keys.
const props = Object.keys(obj_from_json)
.map(key => `${key}:${stringify(obj_from_json[key])}`)
.join(",");
return `{${props}}`;
}