mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 14:09:31 +02:00
#49 | created JSON escaper tool
This commit is contained in:
7
src/pages/tools/json/escape-json/service.ts
Normal file
7
src/pages/tools/json/escape-json/service.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export const escapeJson = (input: string, wrapInQuotesFlag: boolean) => {
|
||||
const escapedJson = JSON.stringify(input);
|
||||
if (!wrapInQuotesFlag) {
|
||||
return escapedJson.slice(1, -1);
|
||||
}
|
||||
return escapedJson;
|
||||
};
|
Reference in New Issue
Block a user