Skip to content
Snippets Groups Projects
Commit 35e95921 authored by Elliot Kang's avatar Elliot Kang
Browse files

prettify OutputParser

parent 08d466fa
Branches
Tags
No related merge requests found
...@@ -61,18 +61,17 @@ function parseJsonMarkdown(text: string) { ...@@ -61,18 +61,17 @@ function parseJsonMarkdown(text: string) {
var left: number; var left: number;
var right: number; var right: number;
if(left_square < left_brace && left_square != -1){ if (left_square < left_brace && left_square != -1) {
left = left_square; left = left_square;
right = text.lastIndexOf("]"); right = text.lastIndexOf("]");
} } else {
else{
left = left_brace; left = left_brace;
right = text.lastIndexOf("}"); right = text.lastIndexOf("}");
} }
const jsonText = text.substring(left, right + 1); const jsonText = text.substring(left, right + 1);
try { try {
//Single JSON object case //Single JSON object case
if(left_square === -1){ if (left_square === -1) {
return [JSON.parse(jsonText)]; return [JSON.parse(jsonText)];
} }
//Multiple JSON object case. //Multiple JSON object case.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment