Created
June 20, 2016 16:21
-
-
Save sdogruyol/cce1a0b9cb39ae276112ce7e2e840a3d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "kemal" | |
post "/json_params" do |env| | |
like_objects = env.params.json["_json"].as Array | |
like_objects.each do |likes| | |
likes_hash = (likes as Hash(String, JSON::Type))["likes"] | |
end | |
end | |
Kemal.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks alot. For some reason, I had an error when I used "_json" (I'm not sure if that was a dummy variable). When I used a key value like below, it worked well. I appreciate you showing the way. I played around with it, and found making a temp variable with the casting made the result a bit more comfortable for me.