STRING::STRINGIFY
1g 2024-09-01 laplante@plcb.ca GOWEB/STRING — Convert Expression to Stringtitle: “STRING::STRINGIFY” version: “1.0.0” date: 2024-09-01 author: “laplante@plcb.ca” section: “1g”
string::stringify Convert Expression to String
string::stringify(expression[, expression, html: bool, error: variable, space: bool, newline: bool, indent: bool])
stringify(expression[, expression, html: bool, error: variable, space: bool, newline: bool, indent: bool])
The stringify
function takes an expression (commonly JSON) and converts it into a string representation.
html
— If true
, output is formatted as HTML.space
— Adds spaces between elements.newline
— Inserts a newline after each element in arrays and maps.indent
— Indents the output for readability.error
— Stores any error encountered during processing.res={{
a := null;
m := { "x" : [1,"2.", 3.4]};
stringify([m, a, "x","ééé世界\t", 4, 6, 7, 3.1415926535, false, true, a, { "9" : 9, "1" : [1,"2.", 3.4], "8": 8}]);
}}.
Returns:
[{"x": [1, "2.", 3.4]}, null, "x", "ééé世界\t", 4, 6, 7, 3.1415926535, false, true, null, {"1": [1, "2.", 3.4], "8": 8, "9": 9}]
res={{
a := null;
m := { "x" : [1,"2.", 3.4]};
stringify(space:false, [m, a, "x","ééé世界\t", 4, 6, 7, 3.1415926535, false, true, a, { "9" : 9, "1" : [1,"2.", 3.4], "8": 8}]);
}}.
Returns:
[{"x":[1,"2.",3.4]},null,"x","ééé世界\t",4,6,7,3.1415926535,false,true,null,{"1":[1,"2.",3.4],"8":8,"9":9}]
res={{
a := null;
m := { "x" : [1,"2.", 3.4]};
stringify(newline:true, [m, a, "x","ééé世界\t", 4, 6, 7, 3.1415926535, false, true, a, { "9" : 9, "1" : [1,"2.", 3.4], "8": 8}]);
}}.
Returns (multi-line):
[
{
"x": [
1,
"2.",
3.4
]
},
null,
"x",
"ééé世界\t",
4,
6,
7,
3.1415926535,
false,
true,
null,
{
"1": [
1,
"2.",
3.4
],
"8": 8,
"9": 9
}
]
res={{
a := null;
m := { "x" : [1,"2.", 3.4]};
stringify(indent:true, [m, a, "x",[9,8,7,6.2], "ééé世界\t", 3, 6, 7, 3.1415926535, false, true, a, { "9" : 9, "1" : [1,"2.", 3.4], "8": 8}]);
}}.
Returns (indented):
[
{
"x": [
1,
"2.",
3.4
]
},
null,
"x",
[
9,
8,
7,
6.2
],
"ééé世界\t",
3,
6,
7,
3.1415926535,
false,
true,
null,
{
"1": [
1,
"2.",
3.4
],
"8": 8,
"9": 9
}
]
res={{
a := null;
m := { "x" : [1,"2.", 3.4]};
stringify(error:err,xindent:true, [m, a, "x",[9,8,7,6.2], "ééé世界\t", 3, 6, 7, 3.1415926535, false, true, a, { "9" : 9, "1" : [1,"2.", 3.4], "8": 8}]);
"error="; err;
}}.
Returns:
error=string::stringify : this parameter 'xindent' is not supported.
laplante@plcb.ca