Skip to main content
added 106 characters in body
Source Link
0xsegfault
  • 6.6k
  • 2
  • 32
  • 69

*i find it theI found a solution is to using the server side javascript like that :

%%[ @JSON,@ListID,lname1 set @JSON = HttpGET('https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA')

]%% %%=v(@JSON)=%%




Platform.Load("Core", "1") // get JSON from ampscript var jsonObj = Variable.GetValue("@JSON"); var obj = Platform.Function.ParseJSON(jsonObj); var Adresse = obj.results[0].formatted_address ; var val = obj.results[0].address_components[0].long_name ; Variable.SetValue("@ListID",Adresse); Variable.SetValue("@lname1",val); // var evaluatedJSON = eval("(" + address_components + ")"); // %%=v(@JSON)=%%

Adresse : %%=v(@ListID)=%%

longName 1   : %%=v(@lname1)=%%



 
 
%%[ @JSON,@ListID,lname1
set @JSON = HttpGET('https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA')

]%%
%%=v(@JSON)=%%


<br>
<br>
<br>

<script runat="server">
    Platform.Load("Core", "1")
    // get JSON from ampscript
    var jsonObj = Variable.GetValue("@JSON");
    var obj = Platform.Function.ParseJSON(jsonObj);
    var Adresse = obj.results[0].formatted_address ;
    var val = obj.results[0].address_components[0].long_name ;
    Variable.SetValue("@ListID",Adresse);
    Variable.SetValue("@lname1",val);
   // var evaluatedJSON = eval("(" + address_components + ")");
  // %%=v(@JSON)=%%
  
</script>
Adresse : %%=v(@ListID)=%%
<br>
<br>
longName 1 : %%=v(@lname1)=%%

<br>
<br>
<br>

*i find it the solution is to using the server side javascript like that :

%%[ @JSON,@ListID,lname1 set @JSON = HttpGET('https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA')

]%% %%=v(@JSON)=%%




Platform.Load("Core", "1") // get JSON from ampscript var jsonObj = Variable.GetValue("@JSON"); var obj = Platform.Function.ParseJSON(jsonObj); var Adresse = obj.results[0].formatted_address ; var val = obj.results[0].address_components[0].long_name ; Variable.SetValue("@ListID",Adresse); Variable.SetValue("@lname1",val); // var evaluatedJSON = eval("(" + address_components + ")"); // %%=v(@JSON)=%%

Adresse : %%=v(@ListID)=%%

longName 1 : %%=v(@lname1)=%%



 
 

I found a solution using server side javascript   :

%%[ @JSON,@ListID,lname1
set @JSON = HttpGET('https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA')

]%%
%%=v(@JSON)=%%


<br>
<br>
<br>

<script runat="server">
    Platform.Load("Core", "1")
    // get JSON from ampscript
    var jsonObj = Variable.GetValue("@JSON");
    var obj = Platform.Function.ParseJSON(jsonObj);
    var Adresse = obj.results[0].formatted_address ;
    var val = obj.results[0].address_components[0].long_name ;
    Variable.SetValue("@ListID",Adresse);
    Variable.SetValue("@lname1",val);
   // var evaluatedJSON = eval("(" + address_components + ")");
  // %%=v(@JSON)=%%
  
</script>
Adresse : %%=v(@ListID)=%%
<br>
<br>
longName 1 : %%=v(@lname1)=%%

<br>
<br>
<br>
Source Link

*i find it the solution is to using the server side javascript like that :

%%[ @JSON,@ListID,lname1 set @JSON = HttpGET('https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA')

]%% %%=v(@JSON)=%%




Platform.Load("Core", "1") // get JSON from ampscript var jsonObj = Variable.GetValue("@JSON"); var obj = Platform.Function.ParseJSON(jsonObj); var Adresse = obj.results[0].formatted_address ; var val = obj.results[0].address_components[0].long_name ; Variable.SetValue("@ListID",Adresse); Variable.SetValue("@lname1",val); // var evaluatedJSON = eval("(" + address_components + ")"); // %%=v(@JSON)=%%

Adresse : %%=v(@ListID)=%%

longName 1 : %%=v(@lname1)=%%