Skip to content

Commit

Permalink
feat: correctly format json when importing from curl (#1472)
Browse files Browse the repository at this point in the history
  • Loading branch information
banjo authored Jan 29, 2024
1 parent d999366 commit 467e63d
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 41 deletions.
109 changes: 71 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/bruno-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@
"idb": "^7.0.0",
"immer": "^9.0.15",
"jsesc": "^3.0.2",
"jsonpath-plus": "^7.2.0",
"jshint": "^2.13.6",
"json5": "^2.2.3",
"jsonlint": "^1.6.3",
"jsonpath-plus": "^7.2.0",
"know-your-http-well": "^0.5.0",
"lodash": "^4.17.21",
"markdown-it": "^13.0.2",
Expand Down
8 changes: 8 additions & 0 deletions packages/bruno-app/src/utils/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ export const safeStringifyJSON = (obj, indent = false) => {
}
};

export const convertToCodeMirrorJson = (obj) => {
try {
return JSON5.stringify(obj).slice(1, -1);
} catch (e) {
return obj;
}
};

export const safeParseXML = (str, options) => {
if (!str || !str.length || typeof str !== 'string') {
return str;
Expand Down
Loading

0 comments on commit 467e63d

Please sign in to comment.