Showing revision 1.0

jdatadecode.m

  newdata=jdatadecode(data,opt,...)
 
  Convert all JData object (in the form of a struct array) into an array
  (accepts JData objects loaded from either loadjson/loadubjson or 
  jsondecode for MATLAB R2018a or later)
 
  This function implements the JData Specification Draft 2 (Oct. 2019)
  see http://github.com/fangq/jdata for details
 
  authors:Qianqian Fang (q.fang <at> neu.edu)
 
  input:
       data: a struct array. If data contains JData keywords in the first
             level children, these fields are parsed and regrouped into a
             data object (arrays, trees, graphs etc) based on JData 
             specification. The JData keywords are
                "_ArrayType_", "_ArraySize_", "_ArrayData_"
                "_ArrayIsSparse_", "_ArrayIsComplex_", 
                "_ArrayZipType_", "_ArrayZipSize", "_ArrayZipData_"
       opt: (optional) a list of 'Param',value pairs for additional options 
            The supported options include
                Recursive: [1|0] if set to 1, will apply the conversion to 
                             every child; 0 to disable
                Base64: [0|1] if set to 1, _ArrayZipData_ is assumed to
                          be encoded with base64 format and need to be
                          decoded first. This is needed for JSON but not
                          UBJSON data
                Prefix: ['x0x5F'|'x'] for JData files loaded via loadjson/loadubjson, the
                          default JData keyword prefix is 'x0x5F'; if the
                          json file is loaded using matlab2018's
                          jsondecode(), the prefix is 'x'; this function
                          attempts to automatically determine the prefix;
                          for octave, the default value is an empty string ''.
                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
 
  output:
       newdata: the covnerted data if the input data does contain a JData 
                structure; otherwise, the same as the input.
 
  examples:
       obj={[],{'test'},true,struct('sparse',sparse(2,3),'magic',uint8(magic(5)))}
       jdata=jdatadecode(jdataencode(obj))
       isequaln(obj,jdata)
 
  license:
      BSD or GPL version 3, see LICENSE_{BSD,GPLv3}.txt files for details 
 
  -- this function is part of JSONLab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab)
Powered by Habitat