| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
JSON.SetFormatOptions
Sets options for formatting JSON.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| JSON | 16.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "JSON.SetFormatOptions" { ; tabIndention; tabAfterObjectKey } ) More
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| tabIndention | What to use for indention. e.g. Char(9) for tabs, Char(32) for spaces. |
" " | Optional |
| tabAfterObjectKey | What to use for space between the double colon and the value in an object. By default this is a space character. |
" " | Optional |
Result
Returns OK or error.
Description
Sets options for formatting JSON.If called without parameters, it will reset to default, Char(9) for indention and a space before object values.
For use in the JSON.Format function.
Examples
Try variants:
Let(
[
json = "{\"test\":1234, \"values\":[2,3,4]}";
// default settings
format1 = MBS( "JSON.Format"; json );
// use minus and plus, so you see it:
r = MBS( "JSON.SetFormatOptions"; "-"; "+" );
format2 = MBS( "JSON.Format"; json );
// no tabs
r = MBS( "JSON.SetFormatOptions"; ""; "" );
format3 = MBS( "JSON.Format"; json );
// reset to default settings
r = MBS( "JSON.SetFormatOptions" )
];
format1 & ¶ & format2 & ¶ & format3
)
Example result:
{ "test": 1234, "values": [2, 3, 4] } { -"test":+1234, -"values":+[2, 3, 4] } { "test":1234, "values":[2, 3, 4] }
[
json = "{\"test\":1234, \"values\":[2,3,4]}";
// default settings
format1 = MBS( "JSON.Format"; json );
// use minus and plus, so you see it:
r = MBS( "JSON.SetFormatOptions"; "-"; "+" );
format2 = MBS( "JSON.Format"; json );
// no tabs
r = MBS( "JSON.SetFormatOptions"; ""; "" );
format3 = MBS( "JSON.Format"; json );
// reset to default settings
r = MBS( "JSON.SetFormatOptions" )
];
format1 & ¶ & format2 & ¶ & format3
)
Example result:
{ "test": 1234, "values": [2, 3, 4] } { -"test":+1234, -"values":+[2, 3, 4] } { "test":1234, "values":[2, 3, 4] }
See also
Release notes
- Version 16.0
- Added JSON.SetFormatOptions function.
Blog Entries
This function is free to use.
Created 12nd December 2025, last changed 12nd December 2025