Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.1.0 - 日本語


toJSON

Convert scilab variable to JSON.

Syntax

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

toJSON(var, filename)
toJSON(var, filename, indent)
toJSON(var, indent, filename)

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 number of spaces.

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 JSON string or a JSON file.

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

バージョン記述
6.1 Function introduced.
2023.0.0 Handling of tabs (ascii(9)) changed.
Report an issue
<< http_upload Web Tools url_decode >>

Copyright (c) 2022-2024 (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:
Mon Jun 17 17:54:24 CEST 2024