> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# JsonValue Class Reference

Part of [MOP json](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__json)

Simple wrapper class to jsoncpp that make working with SWIG more convenient.

## Public Member Functions

| Type | Name |
| - | - |
| [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md) | [\_\_getitem\_\_](#ade4d9808006de9ef3f214d716f89636a) (string name) Function for reading an objects field in python. |
| [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md) | [\_\_getitem\_\_](#ad965145dbdc6f10cd40ee2db83ecaa64) (int index) Function for reading an arrays item in python. |
| | [\_\_setitem\_\_](#a4bfd590c72c08313456d1d4d4f0c1100) (string name, [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md) v) Destructor. |
| | [\_\_setitem\_\_](#a899db9b37cfdc34ca7ae4c0f51727d7e) (int index, [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md) v) Function for setting an arrays intem in python. |
| string | [\_\_str\_\_](#a44139caf93a3463ea4f2a6671cdce842) () Function to print out the [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md) in Python. |
| bool | [AsBool](#aaebc45f8b744f2c30703b7f16993a6ec) () Return the JsonObject as a bool. |
| number | [AsDouble](#aac7ac2c58a1a2933f6b2208f9b3ae9db) () Return the JsonObject as a number value. |
| int | [AsInt](#a36cdae343794112e89c5634c945dda96) () Return the JsonObject as an integer. |
| string | [AsString](#afb0cb51aaa92f311621daed306530e97) () Return the JsonObject as a string. |
| number | [AsUInt](#ad3d35a3fcb15a0eb151833f690f8bd27) () Return the JsonObject as an numbereger. |
| bool | [isObject](#aacf1348d3094868c0c91d3d07e1f794c) () Return if the [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md) is an object. |
| | [JsonValue](#a06d2ac4170c04bc72eff58405b9b8a1b) () Constructor. |
| int | [Size](#af40990b9bd3d70d30e8ce7cdda1ad56f) () The size of the Json object. |

## Detailed Description

Simple wrapper class to jsoncpp that make working with SWIG more convenient.

## Member Function Documentation

### \_\_getitem\_\_() \[1/2]

```cpp theme={null}
JsonValue __getitem__(string name)
```

Function for reading an objects field in python.

**Parameters**

| Name | Description |
| - | - |
| name | The name of the item |

**Returns**

The fields value

### \_\_getitem\_\_() \[2/2]

```cpp theme={null}
JsonValue __getitem__(int index)
```

Function for reading an arrays item in python.

**Parameters**

| Name | Description |
| - | - |
| name | The index of the item in the array |

**Returns**

The items value

### \_\_setitem\_\_() \[1/2]

```cpp theme={null}
__setitem__(
    string name,
    JsonValue v
)
```

Destructor.

Function for setting an objects field in python

**Parameters**

| Name | Description |
| - | - |
| name | The name of the objects field |
| v | The value to set the field to |

### \_\_setitem\_\_() \[2/2]

```cpp theme={null}
__setitem__(
    int index,
    JsonValue v
)
```

Function for setting an arrays intem in python.

**Parameters**

| Name | Description |
| - | - |
| name | The index of the arrays item |
| v | The value to set the item to |

### \_\_str\_\_()

```cpp theme={null}
string __str__()
```

Function to print out the [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md) in Python.

**Returns**

The string containg the JsonValues representation.

### AsBool()

```cpp theme={null}
bool AsBool()
```

Return the JsonObject as a bool.

**Returns**

A bool

### AsDouble()

```cpp theme={null}
number AsDouble()
```

Return the JsonObject as a number value.

**Returns**

A number value

### AsInt()

```cpp theme={null}
int AsInt()
```

Return the JsonObject as an integer.

**Returns**

An integer

### AsString()

```cpp theme={null}
string AsString()
```

Return the JsonObject as a string.

**Returns**

A string

### AsUInt()

```cpp theme={null}
number AsUInt()
```

Return the JsonObject as an numbereger.

**Returns**

An numbereger

### isObject()

```cpp theme={null}
bool isObject()
```

Return if the [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md) is an object.

**Returns**

True iff the [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md) is an object

### Size()

```cpp theme={null}
int Size()
```

The size of the Json object.

**Returns**

The objects size
