From f28f0108406de1f3996e1822ef5f2f63090a828a Mon Sep 17 00:00:00 2001 From: Qianqian Fang Date: Tue, 11 Jun 2019 11:54:57 -0400 Subject: [PATCH] update help info,add the new flags --- loadjson.m | 5 +++++ loadubjson.m | 5 +++++ savejson.m | 8 +++++++- saveubjson.m | 6 ++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/loadjson.m b/loadjson.m index cee0499..7cfc3ff 100644 --- a/loadjson.m +++ b/loadjson.m @@ -48,6 +48,11 @@ % opt.ParseStringArray [0|1]: if set to 0, loadjson converts "string arrays" % (introduced in MATLAB R2016b) to char arrays; if set to 1, % loadjson skips this conversion. +% opt.FormatVersion [2|float]: set the JSONLab format version; since +% v2.0, JSONLab uses JData specification Draft 1 +% for output format, it is incompatible with all +% previous releases; if old output is desired, +% please set FormatVersion to 1.9 or earlier. % % output: % dat: a cell array, where {...} blocks are converted into cell arrays, diff --git a/loadubjson.m b/loadubjson.m index c30e2d9..96c165e 100644 --- a/loadubjson.m +++ b/loadubjson.m @@ -31,6 +31,11 @@ % the "name" tag is treated as a string. To load % these UBJSON data, you need to manually set this % flag to 1. +% opt.FormatVersion [2|float]: set the JSONLab format version; since +% v2.0, JSONLab uses JData specification Draft 1 +% for output format, it is incompatible with all +% previous releases; if old output is desired, +% please set FormatVersion to 1.9 or earlier. % % output: % dat: a cell array, where {...} blocks are converted into cell arrays, diff --git a/savejson.m b/savejson.m index 1438c60..6d956ca 100644 --- a/savejson.m +++ b/savejson.m @@ -83,6 +83,12 @@ % compressed binary array data. % opt.CompressArraySize [100|int]: only to compress an array if the total % element count is larger than this number. +% opt.FormatVersion [2|float]: set the JSONLab output version; since +% v2.0, JSONLab uses JData specification Draft 1 +% for output format, it is incompatible with all +% previous releases; if old output is desired, +% please set FormatVersion to 1.9 or earlier. +% % opt can be replaced by a list of ('param',value) pairs. The param % string is equivallent to a field in opt and is case sensitive. % output: @@ -214,7 +220,7 @@ elseif(isa(item,'categorical')) txt=cell2json(name,cellstr(item),level,varargin{:}); elseif(isobject(item)) - if(~exist('OCTAVE_VERSION','builtin') && exist('istable') && istable(item)) + if(~jsonopt('IsOctave',0,varargin{:}) && exist('istable') && istable(item)) txt=matlabtable2json(name,item,level,varargin{:}); else txt=matlabobject2json(name,item,level,varargin{:}); diff --git a/saveubjson.m b/saveubjson.m index e43cc74..1930055 100644 --- a/saveubjson.m +++ b/saveubjson.m @@ -80,6 +80,12 @@ % element count is larger than this number. % opt.MessagePack [0|1]: output MessagePack (https://msgpack.org/) % binary stream instead of UBJSON +% opt.FormatVersion [2|float]: set the JSONLab output version; since +% v2.0, JSONLab uses JData specification Draft 1 +% for output format, it is incompatible with all +% previous releases; if old output is desired, +% please set FormatVersion to 1.9 or earlier. +% opt.Debug [0|1]: output binary numbers in <%g> format for debugging % % opt can be replaced by a list of ('param',value) pairs. The param % string is equivallent to a field in opt and is case sensitive.