SettingRead_JSON

Reads certain value for a certain setting from FullJSONString text block.
See screenshot for what value will return.
This is one of multiple functions will be posted here next, each will read certain part of json.

CodeFunctionName
What is this?

Public

Tested

Original Work
Function SettingRead_JSON(SettingName, FullJSONString)
    ' Reads certain value for a certain setting from FullJSONString
    ' simply searching for that string enclosed with " and get what is after : until , or ] or ] or ) is found
    ' Needs VBINSTR, CutString9, strUnQuote
    '
    ' "currency": "USD",
    ' "symbol": "APD",
    ' "exchangeName": "NYQ",
    ' "instrumentType": "EQUITY",
    ' "firstTradeDate": 322151400,
    '
    Rett = ""
    Found1 = VBInstr(SettingName, FullJSONString) ' Find "Symbol"
    If Found1 = 0 Then GoTo ByeBye
    Found2 = VBInstr(":", FullJSONString, Found1) ' Find : after word "Symbol"
    If Found2 = 0 Then GoTo ByeBye
    sRettJ = CutString9(FullJSONString, ":", ",|}|]|)", , Found1)
    If sRettJ < > FullJSONString Then Rett = Trim(strUnQuote(sRettJ))
ByeBye:
    SettingRead_JSON = Rett
End Function

SettingName, FullJSONString

Views 231

Downloads 110

CodeID
DB ID