function govnocode(obj) {
const result = {};
for( let key in obj) {
const val = obj[key];
if (Array.isArray(val)) {
result[key] = JSON.stringify(val);
} else {
result[key] = val;
}
}
return JSON.stringify(result);
}
govnocode({"key1": "value1", "key2": ["value1", "value2", "value3"]});
/*
{"key1":"value1","key2":"[\"value1\",\"value2\",\"value3\"]"}
*/