Scilab Home Page | Wiki | Bug Tracker | Forge | Mailing List Archives | Scilab Online Help | ATOMS
File : Details
Login with GitLab

JSON Export

Export Scilab structures to JSON
(1355 downloads for this version - 2302 downloads for all versions)
Christian Klauer
Christian Klauer
Supported Scilab Version
Creation Date
April 21, 2015
            Rev 1 as of 4.3.15: Initial version
Rev 2 as of 4.3.15: added arrays of strings that are defined by e.g.
list('str1', 'str2')
Rev 3 as of 17.3.15: added support for vectors

    Example usage:

    clear a;
    a.Field1 = 2;
    a.Field2 = "jkh";
    a.Field3 = 1.2; = "Joe";
    a.F3.age = 32;
    // = [1,2];
    a.vector = [1,2,3,4.5];
    jsonstr = struct2json(a);

    Warning: For strings make sure you escape the special characters that are
used by the JSON-format!

The precision of float values can be adjusted by the command

Tip: To correctly export NaN values (on Mac or Linux) you could e.g. post
process the json-data (stored in a file) using the sed-command by:

unix('sed -i ''s/%nan/NaN/g'' DataExport.json');

Files (1)
[4.04 kB]
Miscellaneous file
JSON Export
News (0)
Comments (1)     Leave a comment 
Comment from Samuel Gougeon -- July 27, 2018, 12:30:40 PM    
Conversion from and to JSON are certainly useful features.
For information, these ones will become native features in Scilab 6.1.0,
with 2 new functions fromJSON() and toJSON()
Leave a comment
You must register and log in before leaving a comment.
Login with GitLab
Email notifications
Send me email when this toolbox has changes, new files or a new release.
You must register and log in before setting up notifications.