Skip to main content

optiSLang 3D Postprocessing Script API 2025 R1

JsonValue Class Reference

Last update: 16.07.2025

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

Public Member Functions

JsonValue __getitem__ (string name)
 Function for reading an objects field in python. More...
 
JsonValue __getitem__ (int index)
 Function for reading an arrays item in python. More...
 
 __setitem__ (string name, JsonValue v)
 Destructor. More...
 
 __setitem__ (int index, JsonValue v)
 Function for setting an arrays intem in python. More...
 
string __str__ ()
 Function to print out the JsonValue in Python. More...
 
bool AsBool ()
 Return the JsonObject as a bool. More...
 
number AsDouble ()
 Return the JsonObject as a number value. More...
 
int AsInt ()
 Return the JsonObject as an integer. More...
 
string AsString ()
 Return the JsonObject as a string. More...
 
number AsUInt ()
 Return the JsonObject as an numbereger. More...
 
bool isObject ()
 Return if the JsonValue is an object. More...
 
 JsonValue ()
 Constructor.
 
int Size ()
 The size of the Json object. More...
 

Detailed Description

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

Member Function Documentation

◆ __getitem__() [1/2]

JsonValue __getitem__ ( string  name)

Function for reading an objects field in python.

Parameters
nameThe name of the item
Returns
The fields value

◆ __getitem__() [2/2]

JsonValue __getitem__ ( int  index)

Function for reading an arrays item in python.

Parameters
nameThe index of the item in the array
Returns
The items value

◆ __setitem__() [1/2]

__setitem__ ( string  name,
JsonValue  v 
)

Destructor.

Function for setting an objects field in python

Parameters
nameThe name of the objects field
vThe value to set the field to

◆ __setitem__() [2/2]

__setitem__ ( int  index,
JsonValue  v 
)

Function for setting an arrays intem in python.

Parameters
nameThe index of the arrays item
vThe value to set the item to

◆ __str__()

string __str__ ( )

Function to print out the JsonValue in Python.

Returns
The string containg the JsonValues representation.

◆ AsBool()

bool AsBool ( )

Return the JsonObject as a bool.

Returns
A bool

◆ AsDouble()

number AsDouble ( )

Return the JsonObject as a number value.

Returns
A number value

◆ AsInt()

int AsInt ( )

Return the JsonObject as an integer.

Returns
An integer

◆ AsString()

string AsString ( )

Return the JsonObject as a string.

Returns
A string

◆ AsUInt()

number AsUInt ( )

Return the JsonObject as an numbereger.

Returns
An numbereger

◆ isObject()

bool isObject ( )

Return if the JsonValue is an object.

Returns
True iff the JsonValue is an object

◆ Size()

int Size ( )

The size of the Json object.

Returns
The objects size

Connect with Ansys