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
    What help do you need today!
    Interactive Design Solutions http://www.southbound.com
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    My T-shirt Collection is mostly MivaCon T-shirts!!
    Competitive Rates, Popular Modules, and Integrations:
    Product Copy | AutoBaskets | Waitlist Integration| Wholesale Integration

    #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
      What help do you need today!
      Interactive Design Solutions http://www.southbound.com
      MivaMerchant Business Partner | Certified MivaMerchant Web Developer
      My T-shirt Collection is mostly MivaCon T-shirts!!
      Competitive Rates, Popular Modules, and Integrations:
      Product Copy | AutoBaskets | Waitlist Integration| Wholesale Integration

      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
          What help do you need today!
          Interactive Design Solutions http://www.southbound.com
          MivaMerchant Business Partner | Certified MivaMerchant Web Developer
          My T-shirt Collection is mostly MivaCon T-shirts!!
          Competitive Rates, Popular Modules, and Integrations:
          Product Copy | AutoBaskets | Waitlist Integration| Wholesale Integration

          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
              What help do you need today!
              Interactive Design Solutions http://www.southbound.com
              MivaMerchant Business Partner | Certified MivaMerchant Web Developer
              My T-shirt Collection is mostly MivaCon T-shirts!!
              Competitive Rates, Popular Modules, and Integrations:
              Product Copy | AutoBaskets | Waitlist Integration| Wholesale Integration

              Comment

              Working...
              X