pdk.flow.JsonObject

functions to operate with JSON object

All functions


setBoolean

replaces the existing field with a Boolean value or adds a new field.

Arguments:

Result:

  • No variable is returned. A field in the object was set.

Possible exceptions

Example:

jsonObject :: pdk.net.JsonObject = {
    "id": 1,
    "type": "cat"
}

field :: pdk.core.String = "type"
value :: pdk.core.Boolean = true

setBoolean(jsonObject, field, value) :: Void ->
jsonObject = {
    "id": 1,
    "type": true
}
jsonObject :: pdk.net.JsonObject = {
    "id": 1,
    "type": "cat"
}

field :: pdk.core.String = "isProcessed"
value :: pdk.core.Boolean = false

setBoolean(jsonObject, field, value) :: Void ->
jsonObject = {
    "id": 1,
    "type": true,
    "isProcessed": false
}

setFloat

replaces the existing field with a Float value or adds a new field.

Arguments:

Result:

  • No variable is returned. A field in the object was set.

Possible exceptions

Example:

jsonObject :: pdk.net.JsonObject = {
    "id": 1,
    "type": "cat"
}

field :: pdk.core.String = "price"
value :: pdk.core.Float = 10.99

setFloat(jsonObject, field, value) :: Void ->
jsonObject = {
    "id": 1,
    "type": true,
    "price": 10.99
}

setInteger

replaces the existing field with a Integer value or adds a new field.

Arguments:

Result:

  • No variable is returned. A field in the object was set.

Possible exceptions

Example:

jsonObject :: pdk.net.JsonObject = {
    "id": 1,
    "type": "cat"
}

field :: pdk.core.String = "count"
value :: pdk.core.Integer = 81

setInteger(jsonObject, field, value) :: Void ->
jsonObject = {
    "id": 1,
    "type": true,
    "count": 81
}

setString

replaces the existing field with a String value or adds a new field.

Arguments:

Result:

  • No variable is returned. A field in the object was set.

Possible exceptions

Example:

jsonObject :: pdk.net.JsonObject = {
    "id": 1,
    "type": "cat"
}

field :: pdk.core.String = "name"
value :: pdk.core.String = "Tom"

setString(jsonObject, field, value) :: Void ->
jsonObject = {
    "id": 1,
    "type": true,
    "name": "Tom"
}

setJsonObject

replaces the existing field with a JsonObject value or adds a new field.

Arguments:

Result:

  • No variable is returned. A field in the object was set.

Possible exceptions

Example:

jsonObject :: pdk.net.JsonObject = {
    "id": 1,
    "type": "book"
}

field :: pdk.core.String = "author"
value :: pdk.net.JsonObject = {
    "name": "Peter"
}

setJsonObject(jsonObject, field, value) :: Void ->
jsonObject = {
    "id": 1,
    "type": "book",
    "author": {
        "name": "Peter"
    }
}

setJsonArray

replaces the existing field with a JsonArray value or adds a new field.

Arguments:

Result:

  • No variable is returned. A field in the object was set.

Possible exceptions

Example:

jsonObject :: pdk.net.JsonObject = {
    "id": 1,
    "type": "book"
}

field :: pdk.core.String = "tags"
value :: pdk.net.JsonArray = [{
    "id": 1,
    "name": "Detective"
}]

setJsonObject(jsonObject, field, value) :: Void ->
jsonObject = {
    "id": 1,
    "type": "book",
    "tags": [{
        "id": 1,
        "name": "Detective"
    }]
}

removeField

removes field from the jsonObject.

Arguments:

Result:

  • No variable is returned. An object without a field

Possible exceptions

Example:

jsonObject :: pdk.net.JsonObject = {
    "id": 1,
    "type": "book"
}

field :: pdk.core.String = "type"

removeField(jsonObject, field) :: Void ->
jsonObject = {
    "id": 1
}

removeAllFields

removes all fields from the jsonObject.

Arguments:

Result:

  • No variable is returned. An object without any fields

Possible exceptions

Example:

jsonObject :: pdk.net.JsonObject = {
    "id": 1,
    "type": "book"
}

removeAllFields(jsonObject) :: Void ->
jsonObject = {}

mappingToVariable

assigns the JSON Object data to a variable.

Arguments:

Result:

  • No output. The variable is initialized.

Possible exceptions


Last updated