Page 1 of 1

Action Script fromJSON ,Value null error

Posted: 25 Feb 2020 10:20
by rupesh
Hi.

I am a new user and have a little problem.

I make a http request and get a json file which I collect in response variable.

Used a debug dialogue to verify that I did get a valid Json response.Status 200.Fine.
Next I did

data=fromJSON(response);url=data[0]['url'];

Because I want first url from 3 URLs it sent.

But when I execute it gives the error I posted screenshot.

Also I later plan to use the url I receive from json parsing script to download pic.And again I guess if I put url variable in "download" url flow it will give no protocol used error.Since I must use http or https in the url box.So my next question is how to use the url I extract from json parsing to download pic.

Many thanks.Hope I haven't made the issue confusing.





Image

Image

Re: Action Script fromJSON ,Value null error

Posted: 25 Feb 2020 10:56
by anuraag
data = fromJSON(response);
response = data["response"];
images = response["images"];
large_url = images["large"]["url"];

In one line
large_url = fromJSON(response)["response"]["images"]["large"]["url"]

Re: Action Script fromJSON ,Value null error

Posted: 25 Feb 2020 11:05
by rupesh
Thank you so much Anurag.Will give it a try, and update.

Re: Action Script fromJSON ,Value null error

Posted: 25 Feb 2020 11:24
by rupesh
Still getting error Anurag!!


Image

Image

Re: Action Script fromJSON ,Value null error

Posted: 25 Feb 2020 11:29
by anuraag
Don't use both use one

Code: Select all

data = fromJSON(response);
response = data["response"];
images = response["images"];
large_url = images["large"]["url"];
Or

Code: Select all

large_url = fromJSON(response)["response"]["images"]["large"]["url"] 

Re: Action Script fromJSON ,Value null error

Posted: 25 Feb 2020 11:32
by rupesh
I deleted these lines and just kept the single line of code you listed.Now it doesn't give error.

Removed these lines

data = fromJSON(response);
response = data["response"];
images = response["images"];
large_url = images["large"]["url"];

Just kept
large_url = fromJSON(response)["response"]["images"]["large"]["url"]


Can I use large_url variable to download the pic??
I tried but gives no protocol error.

Re: Action Script fromJSON ,Value null error

Posted: 25 Feb 2020 11:34
by anuraag
Attach debug dialog next to above script and check large_url starts with https://

Re: Action Script fromJSON ,Value null error

Posted: 25 Feb 2020 11:41
by rupesh
You awesome dude!!!
👍👍Thanks and lots of love.
Finally working.