How to import json file data to embeded form?


#1

I have json file in which i pernamently rewrite data from my database ,so inside it i have several json object ( i mean i have json array inside my json File) i want to make one form for one json object for this reason i have used embedde forms i mean user task form and angular ui , here is my code:
var jsonFile;
inject([ ‘$scope’, ‘$http’, ‘$location’, ‘Uri’, function($scope, $http, $location, Uri) {

	camForm.on('form-loaded', function () {
		$http.get(Uri.appUri("engine://engine/:engine/process-definition/key/my-process-key/startForm")).success(function(result){
			var contextPath = result.contextPath + '/forms/';		
			var filePath = contextPath + 'data.json';
			$.getJSON(filePath, function(json) {
				jsonFile = json;
			});
		});	
	});
   var jsonData1=JSON.stringify(jsonFile); 
   var rawData=JSON.parse(jsonData1);
    var documentData = $scope.documentData = {
    "id":rawData[i]["id"],
    "organizationNameGE":rawData[i]["organizationNameGE"],
    "organizationNameEN":rawData[i]["organizationNameEN"],
    "cardNumber":rawData[i]["cardNumber"]
    };

camForm.on('form-loaded', function() {
      
      camForm.variableManager.createVariable({
        name: 'documentData',
        type: 'json',
        value: documentData
      });

    });

but it throws exception that i have Unexpected end of input, but when i replace file data with custom data it works perfectly , what am i missing here?
how can i manage to generate one form for each json data object at a time?


#3

Spam above. Don’t click