Action Script fromJSON ,Value null error

Post your questions and help other users.

Moderator: Martin

Post Reply
rupesh
Posts: 9
Joined: 29 Jan 2020 05:44

Action Script fromJSON ,Value null error

Post by rupesh » 25 Feb 2020 10:20

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

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Action Script fromJSON ,Value null error

Post by anuraag » 25 Feb 2020 10:56

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"]

rupesh
Posts: 9
Joined: 29 Jan 2020 05:44

Re: Action Script fromJSON ,Value null error

Post by rupesh » 25 Feb 2020 11:05

Thank you so much Anurag.Will give it a try, and update.

rupesh
Posts: 9
Joined: 29 Jan 2020 05:44

Re: Action Script fromJSON ,Value null error

Post by rupesh » 25 Feb 2020 11:24

Still getting error Anurag!!


Image

Image

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Action Script fromJSON ,Value null error

Post by anuraag » 25 Feb 2020 11:29

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"] 

rupesh
Posts: 9
Joined: 29 Jan 2020 05:44

Re: Action Script fromJSON ,Value null error

Post by rupesh » 25 Feb 2020 11:32

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.

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Action Script fromJSON ,Value null error

Post by anuraag » 25 Feb 2020 11:34

Attach debug dialog next to above script and check large_url starts with https://

rupesh
Posts: 9
Joined: 29 Jan 2020 05:44

Re: Action Script fromJSON ,Value null error

Post by rupesh » 25 Feb 2020 11:41

You awesome dude!!!
👍👍Thanks and lots of love.
Finally working.

Post Reply