ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Read a json-file

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jacob Danell
Read a json-file
on May 20, 2014 at 10:21:35 pm

Hi! I want to read a json-file and use it's data in different dropdown-menus. I have searched a lot now but so far the only way I have found a way to read the file is to use eval() but also bin told not to use it, so how is the most easy way to get the data out from an json-file?


Return to posts index


Dan Ebberts
Re: Read a json-file
on May 20, 2014 at 11:01:43 pm

>the only way I have found a way to read the file is to use eval()

That's the way I've done it.


Dan



Return to posts index

Jacob Danell
Re: Read a json-file
on May 20, 2014 at 11:03:43 pm

Then I'll go with that. Thanks!


Return to posts index



Jacob Danell
Re: Read a json-file
on May 29, 2014 at 7:18:10 pm

After working with my script I found out that eval wasn't the best solution, it's much better to use JSON.parse. That way you really read the json as it's suppose to be read. Eval only converts the code into readable javascript-code so it's not json at all.


Return to posts index

Dan Ebberts
Re: Read a json-file
on May 29, 2014 at 7:28:16 pm

How did you get that to work? As far as I know, ExtendScript is based on v3 of ECMA-262 and JSON.parse() was added after that.


Dan



Return to posts index

Jacob Danell
Re: Read a json-file
on Jul 14, 2014 at 5:20:23 pm

I added the code from json2.js (https://github.com/douglascrockford/JSON-js/blob/master/json2.js) into my jsx file. This only worked for AE5+


Return to posts index


shawn baden
Re: Read a json-file
on Sep 29, 2014 at 5:52:00 pm

Once you've used JSON.parse() how do you call/retrieve the data?

I'm using something like: obj.itemOne[0].item but am getting undefined


Return to posts index

eve Weinberg
Re: Read a json-file
on Aug 31, 2016 at 8:31:05 pm

Could anyone on this thread explain this a bit further to a new JSON user?
I have a json file with a key:value pairing of some text. A few questions:

1) Where is he jsx folder that I should throw the script into?
2) Do I need to activate it inside AE?
3) Where do I write the line: JSON.parse()

What else do I need to know to get this up and running?

Thanks,
Eve


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]