On Tue, 26 Feb 2019, Artur T. wrote:
Dear all,
I've attached a json-file and ran the following example using latest git on
ubuntu 18.10. Gretl crashes at some point when trying to access some element
of a nested bundle as you will see.
<hansl>
string wd = "/home/at/git/json_gretl" # adjust path
string jfile = "(a)wd/ex3.json"
string json_str = readfile(jfile)
B = jsongetb(json_str, "/store/*" ) # all things in store
eval B.store.book[1] # grab 1st of the 4 bundles
# Accessing "price" of the 1st bundle works
eval B.store.book[1].price
# CRASH when accessing the 1st element (price)
eval B.store.book[1][1] # Is this actually a valid accessor?
</hansl>
Thank for the report, that's now fixed in git.
Given a bundle b, b[1] is not a valid reference. There's no such
thing as the "first element" of a bundle, it's an unordered set of
objects which must be accessed by their keys. We now catch that
error rather than crashing.
Allin