CNContact.JSON
--------------

Queries contact as JSON.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Contacts](component_Contacts.md) | [8.4](newinversion84.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |

MBS( "CNContact.JSON"; ContactIdentifier { ; SkipImage } ) 

**MBS**( **"CNContact.JSON";** /\* Queries contact as JSON. \*/  
**$ContactIdentifier**; /\* The contact identifier.e.g. "46B1E34D-58F9-4B6B-A80D-0F71ABB87A0E" \*/   
**$SkipImage**) /\* Optional; If you pass 1, we skip the images.  
Default is 0 to include images.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| ContactIdentifier | The contact identifier. | "46B1E34D-58F9-4B6B-A80D-0F71ABB87A0E" |  |
| SkipImage | If you pass 1, we skip the images.   Default is 0 to include images. | 1 | Optional      Added in version **8.5**. |

### Result

Returns JSON or error.

### Description

Queries contact as JSON.  
If the application is not properly code signed with entitlements, you may only get limited data like no phone numbers.  
### Examples

Query your JSON:

 MBS ( "CNContact.JSON"; MBS ( "[CNContactStore.UnifiedMeContact](CNContactStoreUnifiedMeContact.md)" ) )  
Get formatted and colored JSON:

 Set Variable \[ $json ; Value: MBS ( "CNContact.JSON"; MBS ( "[CNContactStore.UnifiedMeContact](CNContactStoreUnifiedMeContact.md)" ) ) \]   
Set Variable \[ $json ; Value: MBS ("[JSON.Colorize](JSONColorize.md)"; MBS ( "[JSON.Format](JSONFormat.md)"; $json ) ) \]   
Set Field \[ Contacts::Result ; $json \]  
Get JSON of a person:

 Let(\[  
contacts = MBS ( "[CNContactStore.ContactsMatchingName](CNContactStoreContactsMatchingName.md)"; "Christian Schmitz" );  
contactID = GetValue(contacts; 1);  
json = MBS ( "CNContact.JSON"; contactID; 1 )  
\];json)  
### See also

- [CNContact.AddEmailAddress](CNContactAddEmailAddress.md)
- [CNContact.AddPhoneNumber](CNContactAddPhoneNumber.md)
- [CNContact.Name](CNContactName.md)
- [CNContactStore.AddContact](CNContactStoreAddContact.md)
- [CNContactStore.Contacts](CNContactStoreContacts.md)
- [CNContactStore.ContactsMatchingName](CNContactStoreContactsMatchingName.md)
- [CNContactStore.NewContact](CNContactStoreNewContact.md)
- [CNContactStore.UnifiedMeContact](CNContactStoreUnifiedMeContact.md)
- [JSON.Colorize](JSONColorize.md)
- [JSON.Format](JSONFormat.md)

### Release notes

- **Version 13.4**
    - Fixed exception for [CNContact.JSON](https://www.mbsplugins.eu/CNContactJSON.shtml) function.
- **Version 13.2**
    - Added identifier value to the JSON returned by [CNContact.JSON](https://www.mbsplugins.eu/CNContactJSON.shtml) function.
- **Version 8.5**
    - Added SkipImage parameter for [CNContact.JSON](http://www.mbsplugins.eu/CNContactJSON.shtml) function.

### Example Databases

- [Mac and iOS/Contacts/Contacts to FileMaker](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Contacts/Contacts%20to%20FileMaker.shtml#1ScriptAnchor_)
- [Mac and iOS/Contacts/Contacts](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Contacts/Contacts.shtml#3ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Advent calendar - Door 5 - Apple Contacts](https://www.mbsplugins.de/archive/2024-12-05/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.4pr3](https://www.mbsplugins.de/archive/2023-08-16/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.2pr2](https://www.mbsplugins.de/archive/2023-04-13/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 8.5pr1](https://www.mbsplugins.de/archive/2018-10-02/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)

Created 1st August 2018 , last changed 9th February 2022

  
[CNContact.IsUnifiedWithContact](CNContactIsUnifiedWithContact.md) - [CNContact.MailingAddress](CNContactMailingAddress.md)

[HTML Version](CNContactJSON.shtml)