loadjson.m

  data=loadjson(fname,opt)
     or
  data=loadjson(fname,'param1',value1,'param2',value2,...)

  parse a JSON (JavaScript Object Notation) file or string

  authors:Qianqian Fang (fangq<at> nmr.mgh.harvard.edu)
             date: 2011/09/09
          Nedialko Krouchev: http://www.mathworks.com/matlabcentral/fileexchange/25713
             date: 2009/11/02
          Fran?is Glineur: http://www.mathworks.com/matlabcentral/fileexchange/23393
             date: 2009/03/22
          Joel Feenstra:
          http://www.mathworks.com/matlabcentral/fileexchange/20565
             date: 2008/07/03

  $Id: loadjson.m 371 2012-06-20 12:43:06Z fangq $

  input:
       fname: input file name, if fname contains "{}" or "[]", fname
              will be interpreted as a JSON string
       opt: a struct to store parsing options, opt can be replaced by 
            a list of ('param',value) pairs. The param string is equivallent
            to a field in opt.

  output:
       dat: a cell array, where {...} blocks are converted into cell arrays,
            and [...] are converted to arrays
Powered by Habitat