Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all articles
Browse latest Browse all 2143

Loading JSON files from URLS/File Paths into a After Effects

$
0
0

Basically, I want to make a script in which the user enters a file path or URL of a JSON file, the file is loaded and the user can manipulate the data in various ways within After Effects.

 

I got as far as writing a script that requests the data and logs it into the console but it will only work in Extendscript. I'm using Extendables which was built for indesign so that may be the problem.

 

    #include Extendables/extendables.jsx

      

    var url = "http://echo.jsontest.com/key/value/otherkey/othervalue";

  

    //Retrieve the data

    function retrieveData(_url){

        var http = require("http");

        var response = http.get(_url);

        var responseStr = JSON.stringify(response);

        var responseBod = JSON.parse(responseStr);

        var data = JSON.parse(responseBod.body);     

        $.writeln(data.key);

    }

    retrieveData(url);

  

 

When I run it in After Effects I get an error "Undefined is not an object" pointing to line 162 in errors.jsx which says:

 

if (app.name.to('lower').contains("indesign")) {

 

What exactly is happening here? Is there a better way to go about doing requesting JSON files?

 

Thanks!

 

EDIT: I should add that I tried removing the "$.writeln(data.key);" but am still getting the same error.


Viewing all articles
Browse latest Browse all 2143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>