<frojnd>
I'm trying to pass a json payload looks like this: `{"uploads":[{"name":"foo", "bar":["foo","bar"]}, {"name":"bar", "bar":["foo"]}]}` I'm using Kemal framework. Problem is that I don't know how to get further down uploads. How to catch params inside upload array. For uploads I do: uploads = env.params.json["uploads"].as(Array)
<frojnd>
But how do I loop over name and bar?
<frojnd>
Ok I'm inside uploads loop and elemts are of of type JSON::Any how can I parse so I can get to the name and bar?
<frojnd>
Wow, just pp elemnt puted json string for each element! Nice
jmdaemon has quit [Ping timeout: 248 seconds]
<FromGitter>
<Blacksmoke16> frojnd: you have two options
<FromGitter>
<Blacksmoke16> 1) do what you're doing now and work with `JSON::Any`. E.g. to print the name of each obj you could do like: ⏎ ⏎ ```env.params.json["uploads"].as_a.each do |upload| ⏎ pp upload.as_h["name"].as_s ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=62881ac5db6f627d259140be]