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:
jsonObject :: pdk.net.JsonObject
field :: pdk.core.String
value :: pdk.core.Boolean
Result:
No variable is returned. A field in the object was set.
Possible exceptions
NullPointerException - throws if the input object is
NULL
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:
jsonObject :: pdk.net.JsonObject
field :: pdk.core.String
value :: pdk.core.Float
Result:
No variable is returned. A field in the object was set.
Possible exceptions
NullPointerException - throws if the input object is
NULL
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:
jsonObject :: pdk.net.JsonObject
field :: pdk.core.String
value :: pdk.core.Integer
Result:
No variable is returned. A field in the object was set.
Possible exceptions
NullPointerException - throws if the input object is
NULL
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:
jsonObject :: pdk.net.JsonObject
field :: pdk.core.String
value :: pdk.core.String
Result:
No variable is returned. A field in the object was set.
Possible exceptions
NullPointerException - throws if the input object is
NULL
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:
jsonObject :: pdk.net.JsonObject
field :: pdk.core.String
value :: pdk.net.JsonObject
Result:
No variable is returned. A field in the object was set.
Possible exceptions
NullPointerException - throws if the input object is
NULL
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:
jsonObject :: pdk.net.JsonObject
field :: pdk.core.String
value :: pdk.net.JsonArray
Result:
No variable is returned. A field in the object was set.
Possible exceptions
NullPointerException - throws if the input object is
NULL
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:
jsonObject :: pdk.net.JsonObject
field :: pdk.core.String
Result:
No variable is returned. An object without a field
Possible exceptions
NullPointerException - throws if the input object or the field is
NULL
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:
jsonObject :: pdk.net.JsonObject
Result:
No variable is returned. An object without any fields
Possible exceptions
NullPointerException - throws if the input object is
NULL
Example:
jsonObject :: pdk.net.JsonObject = {
"id": 1,
"type": "book"
}
removeAllFields(jsonObject) :: Void ->
jsonObject = {}
mappingToVariable
assigns the JSON Object data to a variable.
Arguments:
jsonObject :: pdk.net.JsonObject
variable :: pdk.core.UserObject
Result:
No output. The variable is initialized.
Possible exceptions
NullPointerException - throws if the input jsonObject is
NULL
JsonMapException - throws if the jsonObject can not be mapped to the variable structure
Last updated