How would I access an array formatted like this? http://pastebin.com/8tSnU5WV
When I try to use
echo -a $json(gameinfo,game,teamTwo,array,2)
I get a random string of numbers. I'm sure I'm just doing it wrong but I don't quite know how to do it. I saw the examples, but I'm not sure how to apply it to URL get. I'm a newbie be gentle. I'm posting this again, because I accidentally posted it as a reply.
When accessing the json, if you are trying to access a 'node' that has child members, a reference to those child members is returned, instead of a value. To get values from the json as you listed, you'd have to specify each member you want to grab.
This returns a reference to game.teamTwo.array[0]:
alias test_json {
jsonopen -ud test http://pastebin.com/raw.php?i=9H43Gbav
echo -s Rating: $json(test, game, teamTwo, array, 0)
}
This gets teamRating
and pickMode
from game.teamTwo.array[0]
:
alias test_json {
jsonopen -ud test http://pastebin.com/raw.php?i=9H43Gbav
echo -s Rating: $json(test, game, teamTwo, array, 0, teamRating)
echo -s pickMode: $json(test, game, teamTwo, array, 1, pickMode)
}
There is no "teamTwo" in the pastebin you posted. Instead of showing just a snippet of the problematic code, could you pastebin the whole code?