PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Michael Greer on December 13, 2024, 04:26:11 PM

Title: Possible "bug" in JSON handling
Post by: Michael Greer on December 13, 2024, 04:26:11 PM
I am hitting an Api endpoint which returns a json payload.  In this case, I am getting 2 items returned so the data tags repeat:

[
  {
    "UPCCode": "00640665853483",
    "VItemID": "98",
    "ItemID": "1891197551",
    "Width": "23.75",
    "Height": "11.00",
    "Length": "6.25",
    "VendorID": "1118101",
    "XOItemID": "1118101-98",
    "Item Name": "Medium Three Light Vanity",
    "Item Number": "853453HB",
    "Image Path": "",
    "Required Items": [
      {
        "SlotRowNum": "4",
        "SlotBase": null,
        "SlotMaxWattage": null,
        "Number": "3",
        "SlotDesc": "12 Watt Medium LED",
        "Required": "1",
        "Included": "0",
        "Name": "Bulbs",
        "LinkedItems": null,
        "FilterKeywords": null,
        "SearchURL": "/lighting-fixtures/light-bulbs?itemNumVal=12 Watt Medium LED",
        "Availability": "Not Included",
        "SearchParam": "12 Watt Medium LED"
      }
    ],
    "Internal Item Number": "YUEX020T6Z"

  },
  {
    "UPCCode": null,
    "VItemID": "12748",
    "ItemID": "2027472751",
    "Width": null,
    "Height": null,
    "Length": null,
    "VendorID": "87",
    "XOItemID": "87-12748",

    "Image Path": "",
    "Short Description": null,
    "Required Items": null,
    "Internal Item Number": "9X26X"
  }

]

Assuming this is in the variable resp$, when I do dim load js$[all]=resp$ I get and error 17.  If I remove what is in italics/blue all works as it should.
Title: Re: Possible "bug" in JSON handling
Post by: Devon Austen on December 13, 2024, 04:44:11 PM
It works for me in the latest version of PxPlus. What version are you trying this on?
Title: Re: Possible "bug" in JSON handling
Post by: Michael Greer on December 13, 2024, 04:48:21 PM
Up to 15.1.  So, it has been addressed. Thanks!