JSON.Equals
-----------

Checks if two JSON are equal.

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

MBS( "JSON.Equals"; json1; json2 ) 

**MBS**( **"JSON.Equals";** /\* Checks if two JSON are equal. \*/  
**$json1**; /\* A JSON text or reference.e.g. {"key": "value"} \*/   
**$json2**) /\* A JSON text or reference.e.g. {"key": "value"} \*/ 

### Parameters

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

### Result

Returns 1, 0 or error.

### Description

Checks if two JSON are equal.  
We compare recursively all nodes.  
If structure and values are the same, we return 1, otherwise 0.  
Objects do not need to have same order for entries.  
### Examples

Compare two numbers:

 MBS ( "JSON.Equals"; 1; 1 )  
<small>  
Example result: 1</small>Comparing strings:

 MBS ( "JSON.Equals"; "\\"Hello\\""; "\\"World\\"" ) &amp;   
MBS ( "JSON.Equals"; "\\"Hello\\""; "\\"Hello\\"" )  
<small>  
Example result: 01</small>Comparing booleans:

 MBS ( "JSON.Equals"; true; true ) &amp;   
MBS ( "JSON.Equals"; false; false ) &amp;   
MBS ( "JSON.Equals"; true; false ) &amp;   
MBS ( "JSON.Equals"; false; true )  
<small>  
Example result: 1100</small>Compare objects:

 MBS ( "JSON.Equals"; "{\\"key\\": \\"value\\"}"; "{\\"key\\": \\"value\\"}") &amp; MBS ( "JSON.Equals"; "{\\"key\\": \\"value\\"}"; "{\\"key\\": \\"Value\\"}")  
<small>  
Example result: 10</small>Unicode escapes consider the same as inline characters:

 MBS ( "JSON.Equals"; "\\"\\uD83C\\uDF4E\\""; "\\"🍎\\"")  
<small>  
Example result: 1</small>### See also

- [JSON.EqualContent](JSONEqualContent.md)

### Release notes

- **Version 9.0**
    - Added [JSON.CreateValue](http://www.mbsplugins.eu/JSONCreateValue.shtml), [JSON.Equals](http://www.mbsplugins.eu/JSONEquals.shtml), [JSON.FindValueInArray](http://www.mbsplugins.eu/JSONFindValueInArray.shtml) and [JSON.FindValueInObjectArray](http://www.mbsplugins.eu/JSONFindValueInObjectArray.shtml) functions.

### Blog Entries

- [The new JSON.EqualContent function](https://www.mbsplugins.de/archive/2020-02-28/The_new_JSONEqualContent_funct/monkeybreadsoftware_blog_filemaker)
- [New in the MBS FileMaker Plugin 10.0](https://www.mbsplugins.de/archive/2020-01-23/New_in_the_MBS_FileMaker_Plugi/monkeybreadsoftware_blog_filemaker)
- [With JSON in excellent form](https://www.mbsplugins.de/archive/2019-11-16/With_JSON_in_excellent_form/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 14th December 2018 , last changed 31st January 2023

  
[JSON.EqualContent](JSONEqualContent.md) - [JSON.FilterObjectArray](JSONFilterObjectArray.md)

[HTML Version](JSONEquals.shtml)