Forum Discussion

hugetv's avatar
hugetv
Visitor
10 years ago

help this error

    jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL("http://"+initConfig()+"/RokuDev/season.php?cve=10&Series=season 1")
json = ParseJson(jsonAsString.GetToString())
return json.Capitulos


Operator attempted with invalid BrightScript Component or interface reference. (runtime error &hec) in pkg:/source/Series/PosterScreen.brs(53)

this error spache for season 1
  • RokuKC's avatar
    RokuKC
    Roku Employee
    "hugetv" wrote:
        jsonAsString = CreateObject("roUrlTransfer")
    jsonAsString.SetURL("http://"+initConfig()+"/RokuDev/season.php?cve=10&Series=season 1")
    json = ParseJson(jsonAsString.GetToString())
    return json.Capitulos


    Operator attempted with invalid BrightScript Component or interface reference. (runtime error &hec) in pkg:/source/Series/PosterScreen.brs(53)

    this error spache for season 1


    For debugging purposes, you could break up your code into steps and verify each step.
    E.g.

    jsonAsString = CreateObject("roUrlTransfer")
    jsonAsString.SetURL("http://"+initConfig()+"/RokuDev/season.php?cve=10&Series=season 1")

    data = jsonAsString.GetToString()
    print "Data: "; data
    ' did the data download succeed? if not, and it is empty or not JSON, ParseJSON is going to fail...

    json = ParseJson(data)
    print "JSON: "; json
    ' did the JSON parse successfully and return an object, or is it invalid?
    ' and does if have a Capitulos field as expected?

    return json.Capitulos