add_json
Related Concepts: Action Results
This function adds json result with entity identifier as title.
siemplify.result.add_json(entity_identifier, json_data)
Parameters
Param Name | Param Type | Possible Values | Comments | Is Mandatory |
---|---|---|---|---|
entity_identifier | string | Any string to be used as title (Does not have to be an entity identifier!) | Using the same title for more than one object will bundle the objects together in the action result view | Yes |
json_data | string OR dict | This parameter can be either a string representing a JSON (json.dumps() can help achieve it, see example above) or a ‘python’ dictionary | Sending the dictionary or dumping it into a string has the same effect. It is recommended to always dump the dictionary into a string. A list can only be sent as a string. | Yes |
Return Type
NoneType
Example
Sample code
siemplify = SiemplifyAction()
import json
data = {
"title": "Product",
"type": "object",
"required": ["id", "name", "price"],
"properties": {
"id": {
"type": "number",
"description": "Product identifier"
},
"stock": {
"type": "object",
"properties": {
"warehouse": {
"type": "number"
},
"retail": {
"type": "number"
}
}
}
}
}
siemplify.result.add_json('Title goes here', json.dumps(data))
Result Behavior
The provided json data gets added as result for the selected entity. Entity can be implicitly selected from the scope
Result Value
None