Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - Français

Change language to:
English - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Aide de Scilab >> Outils web > toJSON

toJSON

Convert scilab variable to JSON.

Syntax

result = toJSON(var)
result = toJSON(var, filename)
result = toJSON(var, filename, indent)

Arguments

var

The Scilab variable to convert in JSON format.

filename

If a file name is given, the conversion is written in this file.

indent

If this argument is given, the result is indented. The value is the size of TAB.

result

Result is a string which contain the data converted to JSON. If a filename is given, no result is returned.

Description

This function convert a Scilab variable into a string or JSON files.

Examples

st = struct("status", "OK", "value", 12);
toJSON(st)
toJSON([1, 2, 3])
st = struct("test", ["a" "b"], "values", [1 2]);
toJSON(st, 4)

See also

History

VersionDescription
6.1 Function introduced.
Report an issue
<< http_upload Outils web Outils Windows >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:50:46 CET 2020