forked from serverlessworkflow/sdk-typescript
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathusing-json.html
40 lines (37 loc) · 1002 Bytes
/
using-json.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Serveless Workflow</title>
<base href="/">
<meta content="width=device-width, initial-scale=1" name="viewport">
</head>
<body>
<pre id="output"></pre>
<script src="../../dist/umd/index.umd.js"></script>
<script type="text/javascript">
(() => {
const { Classes: { Workflow } } = serverWorkflowSdk;
const myJsonWorkflow = `{
"document": {
"dsl": "1.0.0",
"name": "using-json",
"version": "1.0.0",
"namespace": "default"
},
"do": [
{
"step1": {
"set": {
"variable": "my first workflow"
}
}
}
]
}`;
const workflow = Workflow.deserialize(myJsonWorkflow);
document.getElementById('output').innerHTML = `--- YAML ---\n${workflow.serialize()}\n\n--- JSON ---\n${workflow.serialize('json')}`;
})();
</script>
</body>
</html>