Jump to content
UBot Underground

Working With Json


Recommended Posts

Hi all,

Been having some fun with APIs and trying to develop my own skillset more. I am looking at this demo API result which is produced in JSON:

 

https://www.alphavantage.co/query?function=SECTOR&apikey=demo

 

What are the best ways to handle this data with as little resources as possible?

 

Right now here's what I am doing:

Adding the entire page (set variable and use http get) to a list.

 

I then set the desired position to the results I want and delete the pieces of info I don't need from the list position.

Is that the best way to handle this JSON presented data?

 

Whilst I do technically have a solution, I can't help but think there may be a "cleaner" solution.

 

Cheers!

 

Kev

 

 

Link to post
Share on other sites

Can anyone tell me the jsonPath for this URL:

 

https://www.alphavantage.co/query?function=SMA&symbol=MSFT&interval=weekly&time_period=10&series_type=open&apikey=demo

 

I want to get the first result inside "Technical Analysis" "SMA" - the value in there.

 

I can do:

 

$Meta Data.* and get everything from 1 through 7 but can't figure out how to get the next portion

 

Cheers,

 

Kev

 

PS I am using the jsonPath plugin!

Link to post
Share on other sites

 use JsonPathBuilderPro will help you and make json easier

 

set(#HttpGet,$plugin function("HeopasCustom.dll", "$Heopas HTTP Get", "https://www.alphavantage.co/query?function=SMA&symbol=MSFT&interval=weekly&time_period=10&series_type=open&apikey=demo", "", "", "", "", ""),"Global")
clear list(%SMA)
add list to list(%SMA,$list from text($plugin function("JSONpath.dll", "$JSONpath parser", #HttpGet, "Technical Analysis: SMA.*.SMA"),$new line),"Delete","Global")
set(#SMA,$list item(%SMA,0),"Global")
alert("First SMA : {#SMA}")

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...