JSON - Parsing

JaysonHughes

New Member
Joined
Jul 13, 2022
Messages
23
Office Version
  1. 2021
Platform
  1. Windows
So Below is the code that I have but it dose not work.
I have att a image of the data and how it is set out. I wanting to extract "ScannableId" and "quanityItems"

Ideal layout
PaxQTY
paX22vgib0m330


Sub getIbTransferManifest()

With Application
.ScreenUpdating = True
.DisplayAlerts = True
.EnableEvents = True
.CutCopyMode = False
.StatusBar = True

.Calculation = xlCalculationManual
End With

With CreateObject("WbemScripting.SWbemDateTime")
Dim utc#: .SetVarDate VBA.Now
Let utc = .GetVarDate(False) - VBA.Now
End With

'// REQUIRED USER ADJUSTMENTS
'=========================================================================================================================
Dim site$: Let site = "NCL1" '<----- warehouse id
Dim dest$: Let dest = "Pax" '<----- destination worksheet
'=========================================================================================================================

Dim url$: url = "Midway Authentication Portal"

On Error Resume Next
With ThisWorkbook
.Sheets(dest).Cells.ClearContents: If Err Then Err.Clear: _
.Sheets.Add().Name = dest
Dim ws As Worksheet
Set ws = .Sheets(dest)
End With
On Error GoTo 0

With CreateObject("WinHTTP.WinHTTPRequest.5.1")

'===================== Needed for Authentication =============================

'// http service object properties
.SetAutoLogonPolicy 0
.SetTimeouts 0, 0, 0, 0
.SetClientCertificate "CURRENT_USER\MY\" & Environ$("USERNAME")

'// log into midway to authenticate the http connection
.Open "GET", "Midway Authentication Portal", True
.SetRequestHeader "Cookie", VBAMidway_v1
.Send

'// connect to host; recycle url string variable as response text.
.Open "GET", url, False
.SetRequestHeader "Cookie", VBAMidway_v1
.Send

'===================== Needed for Authentication =============================


.WaitForResponse: Let url = _
.ResponseText

End With

Dim json As Object: Set json = aftParse(url)
Dim hdrs As Object: Set hdrs = CreateObject("Scripting.Dictionary")


With Application
.ScreenUpdating = True
.DisplayAlerts = True
.EnableEvents = True
.CutCopyMode = False
.StatusBar = False
.Cursor = xlNorthwestArrow
.Calculation = xlCalculationAutomatic
End With

End Sub
 

Attachments

  • Screenshot 2023-02-20 170644.png
    Screenshot 2023-02-20 170644.png
    73.6 KB · Views: 8

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
In honesty I know nothing about JSON, but if you go to the Data ribbon, on the 'Get & Transform Data' tab you'll see a 'Get Data' button. If you click it you'll have the option to get data 'From File' (amongst other choices), select that and you'll have the option to get from a JSON file. I assume it'll be very useful!!

HTH
 
Upvote 0

Forum statistics

Threads
1,215,076
Messages
6,122,983
Members
449,092
Latest member
Mr Hughes

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