A model conversion method based on Flowable workflow nested JSON
By using recursive parsing and Groovy scripts to process nested JSON, the problems of parsing difficulties and high workflow coupling in nested JSON models are solved, achieving efficient and flexible data transformation and validation, and improving data accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INSPUR SOFTWARE CO LTD
- Filing Date
- 2026-01-14
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies suffer from difficulties in parsing nested JSON models, high coupling between workflow and data model, and insufficient flexibility in dynamic transformation, leading to data loss and transformation errors.
It employs a recursive traversal of nested JSON structures, uses the Flowable workflow engine for field mapping and Groovy language to write dynamic scripts, implements field type conversion and condition judgment, and embeds JSON conversion nodes for error verification and process compensation.
It improves the efficiency of nested JSON processing, reduces the coupling between workflow and data model, enhances dynamic adaptation capabilities, improves data accuracy, and reduces formatting errors and missing fields.
Smart Images

Figure CN122173089A_ABST
Abstract
Description
Technical Field
[0001] This invention discloses a method for model conversion of nested JSON based on Flowable workflow, which relates to the field of computer software technology. Background Technology
[0002] With the development of enterprise informatization, workflow engines such as Flowable are widely used for business process automation. In actual business, JSON, due to its lightweight and structured characteristics, is often used as a carrier for data exchange. However, existing technologies have the following problems when handling nested JSON models: Nested structures are difficult to parse: JSON parsing tools struggle to efficiently handle multi-level nested structures, which can easily lead to data loss or conversion errors.
[0003] The workflow and data model are highly coupled: Flowable's default nodes have limited support for complex JSON, requiring a lot of code to be written manually to adapt to the business model.
[0004] The dynamic conversion lacks flexibility: when business requirements change, the field mapping rules of nested JSON need to be manually modified, lacking automatic adaptation capabilities. Summary of the Invention
[0005] This invention addresses the problems of low efficiency, high coupling between workflow and data model, and poor dynamic adaptability in existing technologies for nested JSON model conversion. It provides a nested JSON model conversion method based on Flowable workflow, which performs complex JSON data processing based on the Flowable workflow engine and is particularly suitable for automated model conversion scenarios with nested JSON structures.
[0006] The specific solution proposed in this invention is as follows: This invention also provides a method for model transformation of nested JSON based on Flowable workflow, which parses the JSON structure by recursively traversing the hierarchical structure of the nested JSON, extracting the paths of all fields, and mapping the JSON fields to the attributes of the target data model based on predefined field mapping rules. Configure Flowable nodes: Embed JSON transformation nodes in the Flowable process to configure field mapping rules and execute dynamic scripts for data type conversion condition checks. Based on the mapping rules and script logic, nested JSON is converted into the target data model through the JSON conversion node, and the conversion result is passed to subsequent nodes through the Flowable process variable or persisted to the database.
[0007] Furthermore, the predefined field mapping rules in the Flowable workflow-based nested JSON model transformation method include fields such as Type, NodeName, NodeUserList, NodeRoleList, and ConditionList, specifically: Type setting: 0 indicates the starting stage, 1 indicates the user task, 4 indicates the gateway route, and 3 indicates the branch condition.
[0008] Furthermore, in the aforementioned method for model conversion using nested JSON based on Flowable workflow, dynamic scripts written in Groovy are used for data type conversion and conditional judgment via JSON conversion nodes.
[0009] Furthermore, in the aforementioned model conversion method based on Flowable workflow and nested JSON, error verification is performed through the JSON conversion node, and process compensation is triggered for missing fields or format errors.
[0010] This invention also provides a model conversion device for nested JSON based on Flowable workflow, including a parsing module, a node configuration module, and a conversion module. The parsing module parses the JSON structure: it recursively traverses the nested JSON hierarchy, extracts the paths of all fields, and maps the JSON fields to attributes of the target data model based on predefined field mapping rules. The node configuration module configures Flowable nodes: It embeds JSON conversion nodes into the Flowable process, which are used to configure field mapping rules and execute dynamic scripts to perform conditional checks for data type conversion. The transformation module converts nested JSON into the target data model through JSON transformation nodes according to mapping rules and script logic, and passes the transformation results to subsequent nodes through Flowable process variables, or persists them to the database.
[0011] Furthermore, the predefined field mapping rules in the parsing module of the Flowable workflow-based nested JSON model conversion device include fields such as Type, NodeName, NodeUserList, NodeRoleList, and ConditionList, specifically: Type setting: 0 indicates the starting stage, 1 indicates the user task, 4 indicates the gateway route, and 3 indicates the branch condition.
[0012] Furthermore, in the aforementioned nested JSON model conversion device based on Flowable workflow, the JSON conversion node uses a node configuration module to write dynamic scripts in Groovy language for data type conversion and condition judgment.
[0013] Furthermore, in the aforementioned model conversion device based on Flowable workflow and nested JSON, the JSON conversion node performs error verification through the node configuration module, triggering process compensation for missing fields or format errors.
[0014] The advantages of this invention are: Improve the efficiency of nested JSON processing: Recursive parsing algorithms reduce the time required for complex JSON transformations to less than 30% of traditional methods. Reduce the coupling between workflow and data model: Through dynamic mapping rules and script isolation, changes to the business model do not require adjustments to the process definition.
[0015] Enhanced dynamic adaptability: Supports real-time adjustment of field mapping relationships through the configuration interface to adapt to changes in business requirements.
[0016] Improve data accuracy: The built-in validation mechanism can intercept more than 90% of formatting errors and missing field issues. Attached Figure Description
[0017] Figure 1 This is a diagram illustrating the execution logic of the JSON conversion node in a flowable process. Detailed Implementation
[0018] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention. Example
[0019] This invention also provides a method for model conversion of nested JSON based on Flowable workflow. Step 1: Parse the JSON structure: Recursively traverse the nested JSON hierarchy, extract the paths of all fields, and map the JSON fields to the attributes of the target data model based on predefined field mapping rules.
[0020] For example, predefined field mapping rules, where fields include Type, NodeName, NodeUserList, NodeRoleList, and ConditionList, specifically: Type setting: 0 indicates the starting stage, 1 indicates the user task, 4 indicates the gateway route, and 3 indicates the branch condition.
[0021] The overall process code can be represented as: { "id": "key-20250625145940100000", "name": "json process model", "nodeConfig": { "nodeName": "Starting Phase", "type": 0, "nodeRoleList": [], "childNode": { "nodeName": "Step 1", "type": 1, "examineLevel": 1, "selectMode": 1, "directorLevel": 1, "termAuto": false, "term": 0, "termMode": 1, "examineMode": 1, "directorMode": 0, "setType": 3, "nodeRoleList": [ { "id": "6880a5ac714b4d05be52d9ced8487db0", "name": "Role in Stage 1" } ], "nodeUserList": [], "childNode": { "nodeName": "Conditional Routing", "type": 4, "conditionNodes": [ { "nodeName": "Condition 1", "type": 3, "priorityLevel": 1, "conditionMode": 1, "conditionList": { "field": "xiaojian", "label": "xiaojian", "operator": "!=", "value": "1" } , "childNode": { "nodeName": "Link 2", "type": 1, "examineLevel": 1, "selectMode": 1, "directorLevel": 1, "termAuto": false, "term": 0, "termMode": 1, "examineMode": 1, "directorMode": 0, "setType": 3, "nodeRoleList": { "id": "71cbd30094634fc8a85596cd1e56dc1c", "name": "Role of Link 2" } , "nodeUserList": [] } }, { "nodeName": "Condition 1", "type": 3, "priorityLevel": 1, "conditionMode": 1, "conditionList": { "field": "xiaojian", "label": "xiaojian", "operator": "!=", "value": "1" } , "childNode": { "nodeName": "Link 2", "type": 1, "examineLevel": 1, "selectMode": 1, "directorLevel": 1, "termAuto": false, "term": 0, "termMode": 1, "examineMode": 1, "directorMode": 0, "setType": 3, "nodeRoleList": { "id": "71cbd30094634fc8a85596cd1e56dc1c", "name": "Role of Link 2" } , "nodeUserList": [] } }, { "nodeName": "Condition 2", "type": 3, "priorityLevel": 2, "conditionMode": 1, "conditionList": { "field": "xiaojian", "label": "xiaojian", "operator": "=", "value": "1" } , "childNode": { "nodeName": "Step 3", "type": 1, "examineLevel": 1, "selectMode": 1, "directorLevel": 1, "termAuto": false, "term": 0, "termMode": 1, "examineMode": 1, "directorMode": 0, "setType": 1, "nodeRoleList": [ { "id": "bd30cc71f17c43b494c2d71bd9cbfe74", "name": "user" } ], "nodeRoleList": [] } } ] } } } } The example structure shows six layers: Start stage — Stage 1 — Branch condition — Stage 2 — Condition end — Stage 3.
[0022] Step 2: Configure Flowable nodes: Embed JSON conversion nodes in the Flowable process. These nodes are used to configure field mapping rules and execute dynamic scripts for data type conversion condition checks. The dynamic scripts can be written in Groovy for data type conversion and condition checks. Error checking can also be performed through the JSON conversion nodes to trigger process compensation for missing fields or format errors.
[0023] Based on the mapping rules and script logic, nested JSON is converted into the target data model through the JSON conversion node, and the conversion result is passed to subsequent nodes through the Flowable process variable or persisted to the database.
[0024] The code for converting the execution result can be found below: { "resourceId": "canvas", "stencil": { "id": "BPMNDiagram" }, "stencilset": { "namespace": "http: / / flowable.org / bpmn" }, "properties": { "process_id": "key-20250625145940100000", "name": "Process model result", "process_namespace": "bpmn", "overrideid": "", "documentation": "", "process_author": "Auhtor", "process_version": "1.0", "executionlisteners": "" }, "childShapes": { "resourceId": "sid-c7b0c2b8-8638-4e18-989c-19b2e5ed3d0b", "stencil": { "id": "StartNoneEvent" }, "childShapes": [], "properties": { "overrideid": "sid-c7b0c2b8-8638-4e18-989c-19b2e5ed3d0b", "name": "", "initiator": "initiator" }, "bounds": { "lowerRight": { "x": 130, "y": 45 }, "upperLeft": { "x": 0, "y": 0 } }, "outgoing": [ { "resourceId": "sequenceFlow-38d312af-e845-4040-8da6-67439c1268d7" } ] }, { "resourceId": "sid-f9237286-9e59-46fc-aa2c-8898322fb257", "stencil": { "id": "UserTask }, "childShapes": [], "properties": { "overrideid": "sid-f9237286-9e59-46fc-aa2c-8898322fb257", "name": "Section 1", "usertaskassignment": "Stage 1 Role [6880a5ac714b4d05be52d9ced8487db0@dgov-ipaas-service@R]" } } ] } Example
[0025] This invention also provides a model conversion device for nested JSON based on Flowable workflow, including a parsing module, a node configuration module, and a conversion module. The parsing module parses the JSON structure: it recursively traverses the nested JSON hierarchy, extracts the paths of all fields, and maps the JSON fields to attributes of the target data model based on predefined field mapping rules. The node configuration module configures Flowable nodes: It embeds JSON conversion nodes into the Flowable process, which are used to configure field mapping rules and execute dynamic scripts to perform conditional checks for data type conversion. The transformation module converts nested JSON into the target data model through JSON transformation nodes according to mapping rules and script logic, and passes the transformation results to subsequent nodes through Flowable process variables, or persists them to the database.
[0026] The information interaction and execution process between the modules in the above-mentioned device are based on the same concept as the method embodiment of the present invention, and the specific details can be found in the description in the method embodiment of the present invention, and will not be repeated here.
[0027] Similarly, the advantages of the device of the present invention are: Improve the efficiency of nested JSON processing: Recursive parsing algorithms reduce the time required for complex JSON transformations to less than 30% of traditional methods. Reduce the coupling between workflow and data model: Through dynamic mapping rules and script isolation, changes to the business model do not require adjustments to the process definition.
[0028] Enhanced dynamic adaptability: Supports real-time adjustment of field mapping relationships through the configuration interface to adapt to changes in business requirements.
[0029] Improve data accuracy: The built-in validation mechanism can intercept more than 90% of formatting errors and missing field issues.
[0030] It should be noted that not all steps and modules in the above processes and device structures are mandatory; some steps or modules may be omitted as needed. The execution order of the steps is not fixed and can be adjusted as required. The device structures described in the above embodiments can be physical or logical structures. That is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or they may be jointly implemented by certain components in multiple independent devices.
[0031] The above-described embodiments are merely preferred embodiments provided to fully illustrate the present invention, and the scope of protection of the present invention is not limited thereto. Equivalent substitutions or modifications made by those skilled in the art based on the present invention are all within the scope of protection of the present invention. The scope of protection of the present invention is defined by the claims.
Claims
1. A method for model transformation of nested JSON based on Flowable workflow, characterized by: Perform JSON structure parsing: recursively traverse the nested JSON hierarchy, extract the paths of all fields, and map the JSON fields to the attributes of the target data model based on predefined field mapping rules. Configure Flowable nodes: Embed JSON transformation nodes in the Flowable process to configure field mapping rules and execute dynamic scripts for data type conversion condition checks. Based on the mapping rules and script logic, nested JSON is converted into the target data model through the JSON conversion node, and the conversion result is passed to subsequent nodes through the Flowable process variable or persisted to the database.
2. The method for model transformation of nested JSON based on Flowable workflow according to claim 1, characterized in that: The predefined field mapping rules include fields such as Type, NodeName, NodeUserList, NodeRoleList, and ConditionList, specifically: Type setting: 0 indicates the starting stage, 1 indicates the user task, 4 indicates the gateway route, and 3 indicates the branch condition.
3. The method for model transformation of nested JSON based on Flowable workflow according to claim 1, characterized in that: A dynamic script written in Groovy is used for data type conversion and conditional judgment via a JSON conversion node.
4. The method for model transformation of nested JSON based on Flowable workflow according to claim 1, characterized in that: Error validation is performed through the JSON conversion node, triggering a compensation process for missing fields or format errors.
5. A model conversion device based on Flowable workflow and nested JSON, characterized in that: It includes a parsing module, a node configuration module, and a conversion module. The parsing module parses the JSON structure: it recursively traverses the nested JSON hierarchy, extracts the paths of all fields, and maps the JSON fields to attributes of the target data model based on predefined field mapping rules. The node configuration module configures Flowable nodes: It embeds JSON conversion nodes into the Flowable process, which are used to configure field mapping rules and execute dynamic scripts to perform conditional checks for data type conversion. The transformation module converts nested JSON into the target data model through JSON transformation nodes according to mapping rules and script logic, and passes the transformation results to subsequent nodes through Flowable process variables, or persists them to the database.
6. The model conversion device based on Flowable workflow and nested JSON according to claim 5, characterized in that: The parsing module predefined field mapping rules include fields such as Type, NodeName, NodeUserList, NodeRoleList, and ConditionList, specifically: Type setting: 0 indicates the starting stage, 1 indicates the user task, 4 indicates the gateway route, and 3 indicates the branch condition.
7. A model conversion device based on Flowable workflow and nested JSON according to claim 5, characterized in that: The JSON conversion node uses a node configuration module to write dynamic scripts in Groovy for data type conversion and conditional judgment.
8. The model conversion device based on Flowable workflow and nested JSON according to claim 5, characterized in that: The JSON conversion node performs error validation through the node configuration module, triggering process compensation for missing fields or format errors.