Announcement

Collapse
No announcement yet.

miva json decode function.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    miva json decode function.

    In an MvCall to a server application, I am receiving a properly valid and formatted JSON response. I am receiving the expected data. However, the miva_json_decode function isn't able convert the string in to a structured array. Before I get too far into the actual data, I am still compiling with 5.34 for some reason. Has there been any bugfixes or updates to this function since compiler version 5.34?

    Scott
    Need to offer Shipping Insurance?
    Interactive Design Solutions https://www.myids.net
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    Competitive Rates, Custom Modules and Integrations, Store Integration
    AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
    My T-shirt Collection is mostly MivaCon T-shirts!!

    #2
    Not that I can think of off the top of my head. What error are you getting? miva_json_decode_last_error will tell you the issue.
    David Carver
    Miva, Inc. | Software Developer

    Comment


      #3
      The error is:

      Line #1 - Syntax error: Expected { or [
      Scott
      Need to offer Shipping Insurance?
      Interactive Design Solutions https://www.myids.net
      MivaMerchant Business Partner | Certified MivaMerchant Web Developer
      Competitive Rates, Custom Modules and Integrations, Store Integration
      AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
      My T-shirt Collection is mostly MivaCon T-shirts!!

      Comment


        #4
        We only support top level arrays or objects. Sounds like the wrong value or variable is being passed in or maybe the response is just a true, false, or null
        David Carver
        Miva, Inc. | Software Developer

        Comment


          #5
          Top Level Only? This won't be parsed?

          Code:
          {
              "errors": "",
              "totalresults": "1",
              "metakeywords": "",
              "metadescription": "",
              "itemlist": [
                 {
                    "skuserial": "1504969",
                    "sku": "ZUN-4T0961",
                    "availability": "In Stock",
                    "availableqtys": [
                       {
                          "location": "WHS",
                          "available": "1"
                       },
                       {
                          "location": "FLR",
                          "available": "0"
                       }
                    ],
                    ... rest of the response here...
          I don't think I've known that limitation and have been fortunate I guess.

          What's the workaround or do you have any code that can beat that limitation?

          Scott
          IDS
          Need to offer Shipping Insurance?
          Interactive Design Solutions https://www.myids.net
          MivaMerchant Business Partner | Certified MivaMerchant Web Developer
          Competitive Rates, Custom Modules and Integrations, Store Integration
          AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
          My T-shirt Collection is mostly MivaCon T-shirts!!

          Comment


            #6
            That will be parsed which means the variable being passed to the decoder is empty. You need to assign s.callvalue to another variable in your MvCALL and then pass that variable to the decode function.
            David Carver
            Miva, Inc. | Software Developer

            Comment


              #7
              Yep. That was the issue. Thank You.

              Scott
              Need to offer Shipping Insurance?
              Interactive Design Solutions https://www.myids.net
              MivaMerchant Business Partner | Certified MivaMerchant Web Developer
              Competitive Rates, Custom Modules and Integrations, Store Integration
              AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
              My T-shirt Collection is mostly MivaCon T-shirts!!

              Comment

              Working...
              X