Skip to main content
Animatinogym
Participating Frequently
July 9, 2021
Answered

json on premier cep Parsing issue

  • July 9, 2021
  • 2 replies
  • 3509 views

 

hi , 
i'm trying to parse array from js to jsx 
the pasring works Great with Aftereffects CEP
however in Premier pro it doesn't work if the data came from

JSON.stringify() it does n't work 


i simplified the code to those lines thisis .jsx 

#include 'json2.js';


function jsontest( ) {
    var randomarray = [3,5,7] ; 
    var arraystrinfied = JSON.stringify(randomarray) ;
    var myJSON = '["shark","fish","dolphin"]' ;
    var obj = JSON.parse(arraystrinfied);    // this doesn't work 
    //var obj = JSON.parse(myJSON);       this works just fine 
    alert(obj[1]); 

}

note that the same code above works fine in After effects 
what is it i'm missing ? 

This topic has been closed for replies.
Correct answer Harchenko

Hi, this code doesn't work for me either.
This is not the first time I've come across the fact that it works for you, but it doesn't work for me

Libraries panel open

 


I beg your pardon, you need to be careful what you write! Thank you! The code works

2 replies

Bruce Bullis
Community Manager
Community Manager
July 11, 2021

> the pasring works Great with Aftereffects CEP

I see that you're including Doug Crockford's json2.js, which is good, because...the JSON object available via ExtendScript is provided by the CC Libraries panel, and is only available when that panel is open. [It's unrelated to CEP.] 


Also, it seems you might need to escape at least some of the quotes in myJSON...?

Animatinogym
Participating Frequently
July 11, 2021

Hi @Bruce Bullis  

thank you for replying 

the thing is myJASON parsed fine no issue i put it to make things clear 

 

the problem with the stringfied array (arrayftringfied ) 

also all works fine in aftereffects both the stringfied array and the quoted one (myJASON)

 

.

 

Bruce Bullis
Community Manager
Community Manager
July 11, 2021

Is the CC Libraries panel open in PPro, when you're attempting to execute your script? If it isn't, arrayStrinfied will always be null, right?

Animatinogym
Participating Frequently
July 11, 2021

i tested it on a windows machine same issue 
any help would be appreciated