How to parse this URL

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Goto Data>New Query and select From Other Sources>Blank Query.

When the Power Query editor opens goto View>Advanced Editor, paste this in.

let
Source = Json.Document(Web.Contents("https://api.binance.com/api/v1/ticker/allPrices")),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"symbol", "price"}, {"Column1.symbol", "Column1.price"})
in
#"Expanded Column1"

and click Done.
 
Upvote 0
Goto Data>New Query and select From Other Sources>Blank Query.

When the Power Query editor opens goto View>Advanced Editor, paste this in.

let
Source = Json.Document(Web.Contents("https://api.binance.com/api/v1/ticker/allPrices")),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"symbol", "price"}, {"Column1.symbol", "Column1.price"})
in
#"Expanded Column1"

and click Done.

Thanks for the prompt answer, but sorry i'm forgot to mentions that i am still using office 2007 and win XP, so sadly Power Query does not support yet for me, any other idea ?
 
Upvote 0
Sub testing()


Set MyRequest = CreateObject("winhttp.winhttprequest.5.1")
MyRequest.Open "GET", "https://api.binance.com/api/v3/ticker/price?symbol=ADABTC"
MyRequest.send
'MsgBox myrequest.responsetext

Dim JSON As Object
Set JSON = JsonConverter.ParseJson(MyRequest.ResponseText)

Range("A1") = JSON("symbol")
Range("B1") = JSON("price")
End Sub

using ms.office 2007
win xp
and vba-json

this code return with errors...anybody could help?
 
Upvote 0
Where are you getting JsonConverter from?

Is it something you've installed?
 
Upvote 0
Where are you getting JsonConverter from?

Is it something you've installed?
 
Upvote 0
I know nothing about JSON text, so I am assuming the beginning part of the code you posted in Message #4 which loads up the MyRequest object is correct... given that, I believe the following code will place the values you want into the active sheet in Columns A:B starting at Row 1...
Code:
[table="width: 500"]
[tr]
	[td]Sub ParseJSON()
  Dim Arr As Variant, MyRequest As Object
  Set MyRequest = CreateObject("winhttp.winhttprequest.5.1")
  MyRequest.Open "GET", "https://api.binance.com/api/v3/ticker/price?symbol=ADABTC"
  MyRequest.send
  Arr = Split(Replace(Replace(Replace(Replace(MyRequest.ResponseText, """", ""), "},{", " "), "[{", ""), "}]", ""))
  With Range("A1").Resize(UBound(Arr) + 1)
    .Value = Application.Transpose(Arr)
    .TextToColumns Range("A1"), xlDelimited, , , False, False, True, False, True, ":", Array(Array(1, 9), Array(2, 1), Array(3, 9), Array(4, 1))
  End With
End Sub[/td]
[/tr]
[/table]
 
Upvote 0
I know nothing about JSON text, so I am assuming the beginning part of the code you posted in Message #4 which loads up the MyRequest object is correct... given that, I believe the following code will place the values you want into the active sheet in Columns A:B starting at Row 1...
Code:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Sub ParseJSON()
  Dim Arr As Variant, MyRequest As Object
  Set MyRequest = CreateObject("winhttp.winhttprequest.5.1")
  MyRequest.Open "GET", "https://api.binance.com/api/v3/ticker/price?symbol=ADABTC"
  MyRequest.send
  Arr = Split(Replace(Replace(Replace(Replace(MyRequest.ResponseText, """", ""), "},{", " "), "[{", ""), "}]", ""))
  With Range("A1").Resize(UBound(Arr) + 1)
    .Value = Application.Transpose(Arr)
    .TextToColumns Range("A1"), xlDelimited, , , False, False, True, False, True, ":", Array(Array(1, 9), Array(2, 1), Array(3, 9), Array(4, 1))
  End With
End Sub[/TD]
[/TR]
</tbody>[/TABLE]

hi rick
got run time error (80090326) when i try to run it
 
Upvote 0
cryptophan

Did you follow the installation instructions on that page?
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top