-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed as not planned
Labels
Description
Let's say I have a json config that looks like the following, and I load it in:
{
"slice": [
{
"name": "apple",
"type": "fruit",
"serving": 1
},
{
"name": "banana",
"type": "fruit",
"serving": 1
},
{
"name": "grape",
"type": "fruit",
"serving": 6
},
{
"name": "carrot",
"type": "veggie",
"serving": 1
},
{
"name": "broccoli",
"type": "veggie",
"serving": 1
}
]
}How, using Get(), would I access slice.2.serving - the serving size for grapes? I would expect that, but I honestly don't know. Is the same string used for GetInt() to access that same location? I didn't see any tests that looked to be referencing an index either.
I've looked through the docs, and I don't really see where it's specified how to get at items within a slice - I saw a lot of named stuff, lots of map[string]interface{}, but no slices.
cassioconti, pekof, schandra157 and xulis