# EnforceTypes

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.CrossplatformJSON/tree/main/Frends.JSON.EnforceTypes>

{% tabs %}
{% tab title="Parameter: EnforceTypesInput" %}

| Name                     | Description                                                                                                                                                                                                                                                                               |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Json : `String`          | <p>The JSON string to be processed.</p><p><br>Default: <code>-</code><br>Example: <code>{"hello": "123","hello\_2": "123.5","world": "true","bad\_arr": "hello, world","bad\_arr\_2": { "prop1": 123 },"good\_arr": \[ "hello, world" ],"good\_arr\_2": \[ { "prop1": 123 } ]}</code></p> |
| Rules : `JsonTypeRule[]` | <p>JSON data type rules to enforce.</p><p><br>Default: <code>-</code><br>Example: <code>\[{new JsonTypeRule{JsonPath = "hello", DataType = JsonDataType.Number }}, {new JsonTypeRule{JsonPath = "hello\_2", DataType = JsonDataType.Number }}]</code></p>                                 |
| {% endtab %}             |                                                                                                                                                                                                                                                                                           |

{% tab title="Result: Result" %}

| Name                    | Description                                                                                                                                                                                                                                  |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| JsonAsString : `String` | <p>The input json as a string.<br>Example: <code>"{"hello": 123,"hello\_2": 123.5,"world": true,"bad\_arr": \["hello, world"],"bad\_arr\_2": \[{"prop1": 123}],"good\_arr": \["hello, world"],"good\_arr\_2": \[{"prop1": 123}]}"</code></p> |
| {% endtab %}            |                                                                                                                                                                                                                                              |

{% tab title="Changelog" %}

## Changelog

### \[1.0.1] - 2022-11-02

#### Updated

* Updated dependency for Newtonsoft.Json from 13.0.1 to 12.0.1

### \[1.0.0] - 2022-04-05

#### Added

* Initial implementation
  {% endtab %}
  {% endtabs %}
