JSON.Sort
---------

Sorts the JSON array/object.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [JSON](component_JSON.md) | [9.3](newinversion93.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "JSON.Sort"; JSON ) 

**MBS**( **"JSON.Sort";** /\* Sorts the JSON array/object. \*/  
**$JSON**) /\* A JSON text or reference.e.g. {"key":"value"} \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| JSON | A JSON text or reference. | {"key":"value"} |

### Result

Returns JSON code.

### Description

Sorts the JSON array/object.  
Use [JSON.SortWithEvaluate](JSONSortWithEvaluate.md) to sort entries within an array of objects.  
### Examples

Sort an array of numbers:

 MBS ( "JSON.Sort"; "\[9,4,3.2 ,3.1 ,123\]" )  
Sort text values:

 MBS ( "JSON.Sort"; "\[\\"123\\", \\"Hello\\", \\"FileMaker\\", \\"World\\"\]" )  
Sort keys in object:

 MBS ( "JSON.Sort"; "{\\"last\\":123, \\"first\\":456}" )  
### See also

- [Files.ListAsJSON](FilesListAsJSON.md)
- [JSON.SortWithEvaluate](JSONSortWithEvaluate.md)

### Release notes

- **Version 15.0**
    - Fixed an insufficient escaping for [JSON.SortWithEvaluate](https://www.mbsplugins.eu/JSONSortWithEvaluate.shtml) function, which sometimes caused an internal error and prevented sorting.
- **Version 10.2**
    - Added [JSON.SortWithEvaluate](https://www.mbsplugins.eu/JSONSortWithEvaluate.shtml) function to sort JSON objects or arrays with custom expression.
- **Version 9.3**
    - Added [JSON.Sort](http://www.mbsplugins.eu/JSONSort.shtml) function.

### Blog Entries

- [Sort with evaluate in FileMaker](https://www.mbsplugins.de/archive/2020-04-10/Sort_with_evaluate_in_FileMake/monkeybreadsoftware_blog_filemaker)
- [With JSON in excellent form](https://www.mbsplugins.de/archive/2019-11-16/With_JSON_in_excellent_form/monkeybreadsoftware_blog_filemaker)
- [Neues vom MBS Plugin 9.3](https://www.mbsplugins.de/archive/2019-09-13/Neues_vom_MBS_Plugin_93/monkeybreadsoftware_blog_filemaker)
- [Whats new in MBS FileMaker Plugin version 9.3](https://www.mbsplugins.de/archive/2019-08-17/Whats_new_in_MBS_FileMaker_Plu/monkeybreadsoftware_blog_filemaker)
- [Neues MBS FileMaker Plugin 9.3 - Über 5900 Funktionen in einem Plugin](https://www.mbsplugins.de/archive/2019-07-24/Neues_MBS_FileMaker_Plugin_93_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 9.3 - More than 5900 Functions In One Plugin](https://www.mbsplugins.de/archive/2019-07-24/MBS_FileMaker_Plugin_93_-_More/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.3pr3](https://www.mbsplugins.de/archive/2019-06-21/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 5/2020, Seite 18](https://filemaker-magazin.de/neuigkeit/4110-Appetithappen-FMM_202005)

This function checks for a license.

Created 15th June 2019 , last changed 29th September 2020

  
[JSON.SetVariables](JSONSetVariables.md) - [JSON.SortWithEvaluate](JSONSortWithEvaluate.md)

[HTML Version](JSONSort.shtml)