Skip to content

Commit f8def3d

Browse files
committed
fix #5 using a modified fast parser and eval
1 parent 5570eb6 commit f8def3d

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

loadjson.m

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@
153153
if(isfield(varargin{1},'progressbar_'))
154154
pbar=varargin{1}.progressbar_;
155155
end
156-
fastparserfailed=0;
157156

158157
if next_char ~= ']'
159158
if(jsonopt('FastArrayParser',1,varargin{:})>=1 && arraydepth>=jsonopt('FastArrayParser',1,varargin{:}))
@@ -205,15 +204,13 @@
205204
end
206205
arraystr=regexprep(arraystr,'\]\s*,','];');
207206
catch
208-
fastparserfailed=1;
209207
end
210208
else
211209
arraystr='[';
212210
end
213211
try
214-
if(fastparserfailed)
215-
throw;
216-
end
212+
arraystr=regexprep(arraystr,'^\s*\[','{','once');
213+
arraystr=regexprep(arraystr,'\]\s*$','}','once');
217214
if(isoct && regexp(arraystr,'"','once'))
218215
error('Octave eval can produce empty cells for JSON-like input');
219216
end

0 commit comments

Comments
 (0)