The JSON quickly gains popularity for a good reason. To paraphrase Christophe Delord (http://christophe.delord.free.fr/tpg/)
JSON is born from a simple statement:
A simple human-like meta-language will quickly
justify its use in such cases as data exchange over the web (e.g. Google translate), configuration files, etc.
See
http://sites.google.com/site/sim4stim/2clicks/a2t.html
for an example of AUTOMATIC, PORTABLE & REUSABLE creation of GUI sets for Matlab.
(Note: p_json.m is at the core of this example too)
Hence it is worth the while to provide this novel facility to the widest possible audience of Matlab users.
Based on work from:
http://json-schema.org/
&
http://www.mathworks.com/matlabcentral/fileexchange/ ::
F.Glineur 23393-another-json-parser: Faster, Clearer & More robust than #20565
J.Feenstra 20565-json-parser
This submission also provides a very simple (yet meaningful) use example (see also the screenshot).
Your test script (called a0t on the screenshot) may look like:
% ---------------------------------------------------------
fName = 'test02.jon';
fid = fopen(fName,'rt'); inString = fscanf(fid,'%c'); fclose(fid);
data = p_json(inString)
% ---------------------------------------------------------
and hence
inString == verbatim the 'test02.jon' TEXT input file,
provided in the .zip (see links below for more detail and more definitions):
% =========================================================
inString =
{
"$schema":
{"properties":{
"name": {"type":"string"},
"age" : {"type":"integer",
"maximum":125,
"optional":true}
},
"type" : "object"
},
"name" : "John Doe",
"age" : 30
}
% =========================================================
*** See also:
Given the topical nature of the JSO notation we invite the user to take a look at places like:
인용 양식
Nedialko (2024). Highly portable JSON-input parser (https://www.mathworks.com/matlabcentral/fileexchange/25713-highly-portable-json-input-parser), MATLAB Central File Exchange. 검색 날짜: .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux카테고리
- MATLAB > Data Import and Analysis > Data Import and Export > Web Access and Streaming > Web Services >
- MATLAB > Language Fundamentals > Data Types > Characters and Strings > String Parsing >
- MATLAB > Data Import and Analysis > Data Import and Export > Standard File Formats > JSON Format >
태그
도움
도움 받은 파일: JSON Parser, (another) JSON Parser
도움 준 파일: JSONLab (Development Branch), Microscopy Image Browser (MIB), Microscopy Image Browser 2 (MIB2), RUBIK1, JSONLab: portable, robust JSON/binary-JSON encoder/decoder
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!