Skip to content

Commit ff933c9

Browse files
author
fangq
committed
handel empty struct array
git-svn-id: http://svn.code.sf.net/p/iso2mesh/code/trunk/jsonlab@469 786e58fb-9377-0410-9ff7-e4ac0ac0635c
1 parent 50c461c commit ff933c9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

savejson.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,14 @@
223223
padding2=repmat(ws.tab,1,level+1);
224224
padding1=repmat(ws.tab,1,level+(dim(1)>1)+(len>1));
225225
nl=ws.newline;
226-
226+
if(isempty(item))
227+
if(~isempty(name))
228+
txt=sprintf('%s"%s": []',padding0,checkname(name,varargin{:}));
229+
else
230+
txt=sprintf('%s[]',padding0);
231+
end
232+
return;
233+
end
227234
if(~isempty(name))
228235
if(len>1) txt=sprintf('%s"%s": [%s',padding0,checkname(name,varargin{:}),nl); end
229236
else

0 commit comments

Comments
 (0)