Skip to content

Commit 8bcf2da

Browse files
authored
Update README.rst
1 parent 51c9080 commit 8bcf2da

File tree

1 file changed

+66
-61
lines changed

1 file changed

+66
-61
lines changed

README.rst

Lines changed: 66 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ data structure. JSONLab supports both MATLAB and
4848
[http://www.gnu.org/software/octave/ GNU Octave] (a free MATLAB clone).
4949

5050
================
51-
II. Installation
51+
Installation
5252
================
5353

5454
The installation of JSONLab is no different than any other simple
@@ -73,66 +73,71 @@ and savejson.m -- a MATLAB->JSON encoder, for the text-based JSON, and
7373
two equivallent functions -- loadubjson and saveubjson for the binary
7474
JSON. The detailed help info for the four functions can be found below:
7575

76-
=== loadjson.m ===
77-
<pre>
78-
data=loadjson(fname,opt)
79-
or
80-
data=loadjson(fname,'param1',value1,'param2',value2,...)
81-
82-
parse a JSON (JavaScript Object Notation) file or string
83-
84-
authors:Qianqian Fang (q.fang <at> neu.edu)
85-
created on 2011/09/09, including previous works from
86-
87-
Nedialko Krouchev: http://www.mathworks.com/matlabcentral/fileexchange/25713
88-
created on 2009/11/02
89-
François Glineur: http://www.mathworks.com/matlabcentral/fileexchange/23393
90-
created on 2009/03/22
91-
Joel Feenstra:
92-
http://www.mathworks.com/matlabcentral/fileexchange/20565
93-
created on 2008/07/03
94-
95-
$Id$
96-
97-
input:
98-
fname: input file name, if fname contains "{}" or "[]", fname
99-
will be interpreted as a JSON string
100-
opt: a struct to store parsing options, opt can be replaced by
101-
a list of ('param',value) pairs - the param string is equivallent
102-
to a field in opt. opt can have the following
103-
fields (first in [.|.] is the default)
104-
105-
opt.SimplifyCell [0|1]: if set to 1, loadjson will call cell2mat
106-
for each element of the JSON data, and group
107-
arrays based on the cell2mat rules.
108-
opt.FastArrayParser [1|0 or integer]: if set to 1, use a
109-
speed-optimized array parser when loading an
110-
array object. The fast array parser may
111-
collapse block arrays into a single large
112-
array similar to rules defined in cell2mat; 0 to
113-
use a legacy parser; if set to a larger-than-1
114-
value, this option will specify the minimum
115-
dimension to enable the fast array parser. For
116-
example, if the input is a 3D array, setting
117-
FastArrayParser to 1 will return a 3D array;
118-
setting to 2 will return a cell array of 2D
119-
arrays; setting to 3 will return to a 2D cell
120-
array of 1D vectors; setting to 4 will return a
121-
3D cell array.
122-
opt.ShowProgress [0|1]: if set to 1, loadjson displays a progress bar.
123-
124-
output:
125-
dat: a cell array, where {...} blocks are converted into cell arrays,
126-
and [...] are converted to arrays
127-
128-
examples:
129-
dat=loadjson('{"obj":{"string":"value","array":[1,2,3]}}')
130-
dat=loadjson(['examples' filesep 'example1.json'])
131-
dat=loadjson(['examples' filesep 'example1.json'],'SimplifyCell',1)
132-
133-
license:
134-
BSD or GPL version 3, see LICENSE_{BSD,GPLv3}.txt files for details
135-
</pre>
76+
----------
77+
loadjson.m
78+
----------
79+
80+
.. code-block:: matlab
81+
82+
<pre>
83+
data=loadjson(fname,opt)
84+
or
85+
data=loadjson(fname,'param1',value1,'param2',value2,...)
86+
87+
parse a JSON (JavaScript Object Notation) file or string
88+
89+
authors:Qianqian Fang (q.fang <at> neu.edu)
90+
created on 2011/09/09, including previous works from
91+
92+
Nedialko Krouchev: http://www.mathworks.com/matlabcentral/fileexchange/25713
93+
created on 2009/11/02
94+
François Glineur: http://www.mathworks.com/matlabcentral/fileexchange/23393
95+
created on 2009/03/22
96+
Joel Feenstra:
97+
http://www.mathworks.com/matlabcentral/fileexchange/20565
98+
created on 2008/07/03
99+
100+
$Id$
101+
102+
input:
103+
fname: input file name, if fname contains "{}" or "[]", fname
104+
will be interpreted as a JSON string
105+
opt: a struct to store parsing options, opt can be replaced by
106+
a list of ('param',value) pairs - the param string is equivallent
107+
to a field in opt. opt can have the following
108+
fields (first in [.|.] is the default)
109+
110+
opt.SimplifyCell [0|1]: if set to 1, loadjson will call cell2mat
111+
for each element of the JSON data, and group
112+
arrays based on the cell2mat rules.
113+
opt.FastArrayParser [1|0 or integer]: if set to 1, use a
114+
speed-optimized array parser when loading an
115+
array object. The fast array parser may
116+
collapse block arrays into a single large
117+
array similar to rules defined in cell2mat; 0 to
118+
use a legacy parser; if set to a larger-than-1
119+
value, this option will specify the minimum
120+
dimension to enable the fast array parser. For
121+
example, if the input is a 3D array, setting
122+
FastArrayParser to 1 will return a 3D array;
123+
setting to 2 will return a cell array of 2D
124+
arrays; setting to 3 will return to a 2D cell
125+
array of 1D vectors; setting to 4 will return a
126+
3D cell array.
127+
opt.ShowProgress [0|1]: if set to 1, loadjson displays a progress bar.
128+
129+
output:
130+
dat: a cell array, where {...} blocks are converted into cell arrays,
131+
and [...] are converted to arrays
132+
133+
examples:
134+
dat=loadjson('{"obj":{"string":"value","array":[1,2,3]}}')
135+
dat=loadjson(['examples' filesep 'example1.json'])
136+
dat=loadjson(['examples' filesep 'example1.json'],'SimplifyCell',1)
137+
138+
license:
139+
BSD or GPL version 3, see LICENSE_{BSD,GPLv3}.txt files for details
140+
</pre>
136141
137142
=== savejson.m ===
138143

0 commit comments

Comments
 (0)