Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
JSON.Format
Returns pretty printed JSON for the given JSON text.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
JSON | 4.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
json | A JSON text or reference. | "[1,2,3]" |
Result
Returns JSON code.
Description
Returns pretty printed JSON for the given JSON text.See also JSON.Compact to get a compact format.
Examples
Format some object:
Set Variable [$json; Value:MBS( "JSON.Format"; "{\"Hello\": \"World\"}" )]
Show Custom Dialog [$json]
Parse some JSON, display it formatted and release:
Set Variable [$json; Value:MBS( "JSON.Parse"; "{\"Hello\": \"World\"}" )]
Show Custom Dialog [$json; MBS("JSON.Format"; $json)]
Set Variable [$r; Value:MBS( "JSON.Release"; $json)]
Format various JSON entries:
MBS( "JSON.Format";
"{
\"Hello\": \"World\",
\"num\": 123,
\"value\": 123.456,
\"object\": {\"Hello\": \"World\"},
\"empty\": null,
\"array\": [1,2,3]}")
Example result:
{
"Hello": "World",
"num": 123,
"value": 123.456,
"object": {
"Hello": "World"
},
"empty": null,
"array": [1, 2, 3]
}
Colorize and format in Auto-Enter calculation:
Let ( [
jsonFormatted = MBS("JSON.Format"; Self);
jsonFormatFailed = MBS("IsError");
jsonText = If(jsonFormatFailed; Self; jsonFormatted);
result = MBS("JSON.Colorize"; jsonText)
]; result )
// put this calculation into a field, so the field gets formated and colorized whenever the field is changed and the record gets commited.
Format JSON removes unicode escapes:
MBS( "JSON.Format"; "\"\uD83C\uDF4E\"")
Example result: "🍎"
See also
- IBAN.Format
- JSON.Colorize
- JSON.Compact
- JSON.CreateArrayRef
- JSON.CreateObjectRef
- JSON.DeleteItemFromArray
- JSON.GetArraySize
- JSON.Parse
- MapView.Snapshot
- Text.AddLineNumbers
Release notes
- Version 11.2
- Fixed JSON.Format to not return reference number for JSON reference numbers as input, broken in 11.1.
- Version 9.4
- Improved pretty formatting for JSON arrays in JSON.Format.
Example Databases
- Barcode/Barcode Generation JSON
- CURL/Email/IMAP Email List
- CURL/Email/IMAP Email
- JSON/JSON Benchmark
- JSON/JSON Insert and Update
- JSON/JSON Query
- Mac and iOS/Contacts/Contacts
- Mac and iOS/MapKit/MapKit Snapshots
- Network/Bonjour
- XML/XML and JSON
Blog Entries
- MBS Plugin Advent calendar: 2 - Vision
- FileMaker and MongoDB
- MBS FileMaker Plugin, version 11.2pr1
- With JSON in excellent form
- MBS FileMaker Plugin, version 9.4pr1
- Fun with While function in FileMaker
- Neues MBS FileMaker Plugin 8.3
- MBS FileMaker Plugin 8.3 released
- Colorize JSON or XML in FileMaker with line numbers
- MBS Filemaker Plugin, version 4.4pr6
FileMaker Magazin
This function checks for a license.
Created 18th October 2014, last changed 15th March 2024