JSON.AddBooleanToObject
-----------------------

Adds a boolean value to an array.

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

MBS( "JSON.AddBooleanToObject"; JSON; Name...; Value... ) 

**MBS**( **"JSON.AddBooleanToObject";** /\* Adds a boolean value to an array. \*/  
**$JSON**; /\* A JSON text or reference.e.g. \[false,true,false\] \*/   
**$Name...**; /\* The name of the key.e.g. "Hello" \*/   
**$Value...**) /\* The boolean to be added.  
Pass 1 for true and 0 for false.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| JSON | A JSON text or reference. | \[false,true,false\] |
| Name... | The name of the key. | "Hello" |
| Value... | The boolean to be added.   Pass 1 for true and 0 for false. | 1 |

### Result

Returns JSON code or error.

### Description

Adds a boolean value to an array.  
Same as [JSON.AddItemToArray](JSONAddItemToArray.md), but calls [JSON.CreateBoolean](JSONCreateBoolean.md) automatically for you.  
  
With version 6, you can pass several parameters to add several entries to the array.  
When adding to a JSON reference, the function returns that reference number.  
  
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.  
Please repeat Name and Value parameters as often as you need.  
### Examples

Add a boolean to object:

 Set Variable \[$json ; Value:MBS ( "[JSON.Parse](JSONParse.md)"; "{\\"Hello\\": \\"World\\"}" )\]  
Set Variable \[$json ; Value:MBS ( "JSON.AddBooleanToObject"; $json ; "test"; 1)\]  
Show Custom Dialog \[$json ; MBS ("[JSON.Format](JSONFormat.md)"; $json )\]  
Set Variable \[$r ; Value:MBS ( "[JSON.Release](JSONRelease.md)"; $json )\]  
Add a value:

 MBS ( "JSON.AddBooleanToObject"; "{}"; "test"; 1 )  
<small>  
Example result:   
{ "test" : true } </small>### See also

- [JSON.AddFalseToObject](JSONAddFalseToObject.md)
- [JSON.AddItemToArray](JSONAddItemToArray.md)
- [JSON.AddNumberToObject](JSONAddNumberToObject.md)
- [JSON.CreateArrayRef](JSONCreateArrayRef.md)
- [JSON.CreateBoolean](JSONCreateBoolean.md)
- [JSON.CreateObjectRef](JSONCreateObjectRef.md)
- [JSON.DeleteItemFromObject](JSONDeleteItemFromObject.md)
- [JSON.Format](JSONFormat.md)
- [JSON.Parse](JSONParse.md)
- [JSON.Release](JSONRelease.md)

### Blog Entries

- [With JSON in excellent form](https://www.mbsplugins.de/archive/2019-11-16/With_JSON_in_excellent_form/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.0pr6](https://www.mbsplugins.de/archive/2016-01-13/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

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

This function is free to use.

Created 5th January 2016 , last changed 5th June 2021

  
[JSON.AddArrayToArray](JSONAddArrayToArray.md) - [JSON.AddFalseToObject](JSONAddFalseToObject.md)

[HTML Version](JSONAddBooleanToObject.shtml)