Getting names from json

  1. 4 weeks ago

    Tim K

    Nov 13 Pre-Release Testers, Xojo Pro

    Using the classic framework jsonitem how do I get the corresponding names ?

    "note_attributes": [
            {
              "name": "PO",
              "value": "P.0.Box info test"
            },
            {
              "name": "Shipping_Account",
              "value": "Fedex or UPS info test"
            }
          ]
          
                    dim order_attr_list,order_attr As JSONItem
                  order_attr_list=Order.Value("note_attributes")    
                  dim attrName, attrValue As String
                    for yy as integer=0 to order_attr_list.Count -1
                      attrName=order_attr_list.Name(yy)
                      attrValue=order_attr_list.Value(attrName)
                      msgbox(attrName + " " +  attrValue ) //+ " " + order_attr.Values(yy))
                    next

    Latest attempt

    Thanks

    Tim

  2. Greg O

    Nov 13 Xojo Inc
    Dim names() as String = order_attr_list.Names()

or Sign Up to reply!