public JSONObject generateJSONRequest ( String sourceName , List < String > sourceNodes , String targetName , List < String > targetNodes ) throws JSONException { Context sourceContext = new Context ( "SourceContext" , sourceName , sourceNodes ) ; Context targetContext = new Context ( "TargetContext" , targetName , targetNodes ) ; JSONObject jRequest = new JSONObject ( ) ; JSONObject jContexts = new JSONObject ( ) ; JSONArray jContextList = new JSONArray ( ) ; JSONObject jsourceContext = sourceContext . toJsonObject ( ) ; JSONObject jtargetContext = targetContext . toJsonObject ( ) ; jContextList . put ( jsourceContext ) ; jContextList . put ( jtargetContext ) ; jContexts . put ( "Contexts" , jContextList ) ; jRequest . put ( "parameters" , jContexts ) ; return jRequest ; }
Generates JSON request from input parameters