There are two things you can do. One option is to replace the value :params
with the map obtained after parsing the JSON. To do this, simply map the new map to the key :params
.
(assoc req [:params] (json/parse-string (slurp (:body req)) true))
Another option (as @dAni suggests) is to combine the values ββof the parsed JSON so that the existing values ββin the map :params
not overridden. The reason you need to use partial
instead of just using merge
here is because the final map is the combined result of the maps from left to right. Your solution works if you want the values ββfrom the JSON map to take precedence.
(update-in req [:params] (partial merge (json/parse-string (slurp (:body req)) true)))
source share