Defining array of values for DATA-INTO

Discussions relating to the ScottKlement.com port of the open source YAJL JSON Reader/Generator. This includes the YAJL tool as well as the YAJLR4, YAJLGEN, YAJLINTO and YAJLDTAGEN add-ons from ScottKlement.com. http://www.scottklement.com/yajl/
Post Reply
mjhaston
Posts: 3
Joined: Thu Aug 04, 2022 4:37 pm

Defining array of values for DATA-INTO

Post by mjhaston »

Just starting to tinker with DATA-INTO and free form D-Specs. I will say, defining these data structures is much easier in free!

How would I define BundleIdList since it's just an array with no named element?
"BundleIdList": [1101],

Code: Select all

{
	"ErrorCode": 0,
	"ShipmentResponse": {
		"PackageDefaults": {
			"ErrorCode": 0,
			"ErrorMessage": "No error",
			"ArriveTime": "23:59:59",
			"ManifestId": 0,
			"RatedService": {
				"Symbol": "CONNECTSHIP_UPS.UPS.GND",
				"Name": "UPS Ground (CSAdapter)"
			},
			"Service": {
				"Symbol": "CONNECTSHIP_UPS.UPS.GND",
				"Name": "UPS Ground (CSAdapter)"
			},
			"ShippedService": {
				"Symbol": "CONNECTSHIP_UPS.UPS.GND",
				"Name": "UPS Ground (CSAdapter)"
			},
			"TimeInTransitDays": -1,
			"BaseCharge": {
				"Amount": 22.58,
				"Currency": "USD"
			},
			"BundleIdList": [1101],
			"FuelSurcharge": {
				"Amount": 4.66,
				"Currency": "USD"
			},
			"Special": {
				"Amount": 9.51,
				"Currency": "USD"
			},
			"TimeInTransit": "FOREVER",
			"Total": {
				"Amount": 32.09,
				"Currency": "USD"
			}
		}
	}
}

jonboy49
Posts: 200
Joined: Wed Jul 28, 2021 8:18 pm

Re: Defining array of values for DATA-INTO

Post by jonboy49 »

I've not encountered this before but have you tried simply coding it as:

Code: Select all

BundleIdList  int(5)  Dim(nn);
What does YAJLGEN show?
mjhaston
Posts: 3
Joined: Thu Aug 04, 2022 4:37 pm

Re: Defining array of values for DATA-INTO

Post by mjhaston »

That's funny, I was just about to reply to you on another similar answer on another board! I tried allowextra=yes, but that didn't seem to work to ignore it.

But your solution here worked. I kind of screwed myself thinking I needed to describe it as a DS!

Thanks once again jonboy.
Post Reply