Add JSON data related struct and function into context.

Test: local test
Change-Id: I7a2000b458378f240cd6481066c15dec98d110ea
diff --git a/context.go b/context.go
index f7cddfc..92c5d30 100644
--- a/context.go
+++ b/context.go
@@ -2300,6 +2300,26 @@
 	AddJSONData(d *map[string]interface{})
 }
 
+// A JSONDataAction contains the inputs and outputs of actions of a module. Which helps pass such
+// data to be included in the JSON module graph.
+type JSONDataAction struct {
+	Inputs  []string
+	Outputs []string
+}
+
+// FormatJSONDataActions puts the content of a list of JSONDataActions into a standard format to be
+// appended into the JSON module graph.
+func FormatJSONDataActions(jsonDataActions []JSONDataAction) []map[string]interface{} {
+	var actions []map[string]interface{}
+	for _, jsonDataAction := range jsonDataActions {
+		actions = append(actions, map[string]interface{}{
+			"Inputs":  jsonDataAction.Inputs,
+			"Outputs": jsonDataAction.Outputs,
+		})
+	}
+	return actions
+}
+
 func jsonModuleFromModuleInfo(m *moduleInfo) *JsonModule {
 	result := &JsonModule{
 		jsonModuleName: *jsonModuleNameFromModuleInfo(m),