Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
jsonParse now validates for array as root JSONs fixes #1097
Andrew Bastin2bd242a1649f
diff --git a/helpers/jsonParse.js b/helpers/jsonParse.jsindex 23ceb4de3..3250f93a8 100644--- a/helpers/jsonParse.js+++ b/helpers/jsonParse.js@@ -25,9 +25,16 @@ export default function jsonParse(str) {start = end = lastEnd = -1ch()lex()- const ast = parseObj()- expect("EOF")- return ast+ try {+ const ast = parseObj()+ expect("EOF")+ return ast+ } catch (e) {+ // Try parsing expecting a root array+ const ast = parseArr()+ expect("EOF")+ return ast+ }}let string