JSON.AddTrueToObject
--------------------

Adds a new entry to the object with the given name and a boolean true value.

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

MBS( "JSON.AddTrueToObject"; JSON; Name... ) 

**MBS**( **"JSON.AddTrueToObject";** /\* Adds a new entry to the object with the given name and a boolean true value. \*/  
**$JSON**; /\* A JSON text or reference.e.g. {"key": "value"} \*/   
**$Name...**) /\* The name of the Object property.e.g. "length" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| JSON | A JSON text or reference. | {"key": "value"} |
| Name... | The name of the Object property. | "length" |

### Result

Returns JSON code.

### Description

Adds a new entry to the object with the given name and a boolean true value.  
  
With version 6, you can pass several parameters to add several entries to the object.  
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 parameter as often as you need.  
### Examples

Adds two entries with true to empty array:

 MBS ( "JSON.AddTrueToObject"; "{}"; "hello"; "world")  
<small>  
Example result:   
{ "hello" : true, "world" : true } </small>Adds true to object:

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

- [JSON.AddFalseToObject](JSONAddFalseToObject.md)
- [JSON.AddItemToObject](JSONAddItemToObject.md)
- [JSON.AddNullToObject](JSONAddNullToObject.md)
- [JSON.AddNumberToObject](JSONAddNumberToObject.md)
- [JSON.AddStringToObject](JSONAddStringToObject.md)
- [JSON.AddValueToObject](JSONAddValueToObject.md)
- [JSON.CreateObjectRef](JSONCreateObjectRef.md)

### Blog Entries

- [With JSON in excellent form](https://www.mbsplugins.de/archive/2019-11-16/With_JSON_in_excellent_form/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 18th August 2014 , last changed 5th June 2021

  
[JSON.AddStringToObject](JSONAddStringToObject.md) - [JSON.AddValueToArray](JSONAddValueToArray.md)

[HTML Version](JSONAddTrueToObject.shtml)